You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cayenne.apache.org by Marcin Skladaniec <ma...@ish.com.au> on 2009/01/14 02:52:12 UTC
nested contexts hierarchy
Hi
How do I test whether a context is a child of another one?
I looked up the javadocs and code for this functionality,
but I failed to find any. The relationship between
contexts seems to be resolved on DataChannel level, but I
cannot grasp how it actually happens.
I think methods like getParentContext() and
getChildContexts() can be useful.
Best regards
Marcin
Re: nested contexts hierarchy
Posted by Marcin Skladaniec <ma...@ish.com.au>.
On Wed, 14 Jan 2009 10:53:51 +0200
Andrus Adamchik <an...@objectstyle.org> wrote:
>> getParentContext()
>
> Parent context is a DataChannel of a child, so
>getChannel() would return a parent DataContext in case
>of a nested context and DataDomain in case of a
>top-level context.
thank you, that was what I did not understand.
>
>> getChildContexts()
>
> Context doesn't track its child contexts, only
>indirectly via event manager. If somebody describes a
>case of why enumerating through a context children might
>be useful (other then sending events, which is already
>implemented), we may add it, storing children via weak
> references to avoid introducing a requirement of
>explicitly closing the child context.
indeed, I cannot think about the use of it now.
Thank you for help.
Marcin
>
> Andrus
>
>
> On Jan 14, 2009, at 3:52 AM, Marcin Skladaniec wrote:
>
>> Hi
>>
>> How do I test whether a context is a child of another
>>one? I looked
>> up the javadocs and code for this functionality, but I
>>failed to
>> find any. The relationship between contexts seems to be
>>resolved on
>> DataChannel level, but I cannot grasp how it actually
>>happens.
>> I think methods like getParentContext() and
>>getChildContexts() can
>> be useful.
>>
>> Best regards
>> Marcin
>>
>
Re: nested contexts hierarchy
Posted by Andrus Adamchik <an...@objectstyle.org>.
> getParentContext()
Parent context is a DataChannel of a child, so getChannel() would
return a parent DataContext in case of a nested context and DataDomain
in case of a top-level context.
> getChildContexts()
Context doesn't track its child contexts, only indirectly via event
manager. If somebody describes a case of why enumerating through a
context children might be useful (other then sending events, which is
already implemented), we may add it, storing children via weak
references to avoid introducing a requirement of explicitly closing
the child context.
Andrus
On Jan 14, 2009, at 3:52 AM, Marcin Skladaniec wrote:
> Hi
>
> How do I test whether a context is a child of another one? I looked
> up the javadocs and code for this functionality, but I failed to
> find any. The relationship between contexts seems to be resolved on
> DataChannel level, but I cannot grasp how it actually happens.
> I think methods like getParentContext() and getChildContexts() can
> be useful.
>
> Best regards
> Marcin
>