cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Gentry <mgen...@masslight.net>
Subject Re: How to check if an ObjectContext is the root ObjectContext? (has no parent)
Date Fri, 04 Mar 2016 13:56:27 GMT
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
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message