Re: [Simple-support] how to have a link to the parent
Brought to you by:
niallg
|
From: Niall G. <gal...@ya...> - 2008-03-12 18:45:21
|
Hi,
I am not sure what you mean by access. If your talking
about an object reference access, then thats simple.
Do the following.
class Parent {
public void commit(Map session){
session.put("parent", this);
}
}
class Child {
public void commit(Map session) {
Parent p = (Parent)session.get("parent");
// ... do whatever
}
}
Hope this helps.
Niall
--- Benoît Pointet <ben...@un...> wrote:
> Hi there!
>
> first of all thanks ... it's so simple! so simple
> that when I hit
> something, I can't help myself from thinking I've
> misread the doc. But
> after having read it twice, I still have this
> problem :
>
> I'm working on a simulation toolkit, companion of a
> multi-agent
> communication system.
> the toolkit involves configuring complex scenarios
> with xml.
>
> the structure of those config XML files looks like :
>
> simulation
> . platform
> . . agent
> . . . argument
> . . agent
> . . agent
> . population
> . . actor
> . . . profile
> . . . agent
> . . . . type
> . . . . classname
> . . . agent
> . scenario
> . . phase
> . . . agent
> . . . action
> . . phase
>
> ...you get the picture
>
> I successfully can deserialize this structure into a
> structure of
> corresponding objects, and the id-ref mechanism
> works like a charm.
>
> But I surely would need that AN OBJECT MAY ACCESS
> ITS PARENT in this
> object hierarchy.
>
> I naively though there'd be a @Parent annotation one
> may apply to a
> field (of type Object) to automatize linking to
> parent, but this don't
> exist.
>
> I could I generalize this linking to the parent
> object at
> deserialization time ?
>
> thanks,
> b.
>
>
-------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio
> 2008.
>
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Simple-support mailing list
> Sim...@li...
>
https://lists.sourceforge.net/lists/listinfo/simple-support
>
____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
|