cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrus Adamchik <and...@objectstyle.org>
Subject Re: How to check if an ObjectContext is the root ObjectContext? (has no parent)
Date Sun, 06 Mar 2016 15:44:57 GMT
Yep, still true in 4.0

> On Mar 4, 2016, at 5:56 AM, Michael Gentry <mgentry@masslight.net> wrote:
> 
> Hi Hugi,
> 
> I believe that's true, at least for 3.1.  I had this lying around somewhere
> that seemed to work:
> 
>    public static boolean isChildContext(ObjectContext context)
>    {
>        if (context.getChannel() instanceof ObjectContext)
>            return true;
>        else
>            return false;
>    }
> 
> mrg
> 
> 
> 
> On Fri, Mar 4, 2016 at 5:34 AM, Hugi Thordarson <hugi@karlmenn.is> wrote:
> 
>> Hi all.
>> How do I check if an ObjectContext is the root ObjectContext, i.e. does
>> not have a parent ObjectContext? Do I simply check if the ObjectContext’s
>> channel is an instance of an ObjectContext to see if it’s a child context?
>> 
>> Cheers,
>> - hugi


Mime
View raw message