You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by Felix Meschberger <fm...@gmail.com> on 2007/09/26 09:08:22 UTC

[ocm] mapping selection

Hi,

When a node is mapped by calling the ObjectConverter.getObject(Session,
Class, String) method and no discriminator property is configured the
ObjectConverterImpl class tries to find a "best" mapping for the
effective node. This is done by walking the class descriptor hierarchy
starting at the descriptor for the selected class until a mapping for
the node type is found.

In case the class descriptor hierarchy is incomplete because an
improperly defined class descriptor would actually perfectly map the
node but is not declared to extend (or implement) its parent
classes/interfaces, the hierarchy walk down will not find the mapping
and thus in the end, the originally requested class will be
instantiated. If the class is abstract or an interface this of course
fails.

If an exact class descriptor for the node type would be looked up
directly, the mapping might be found immediately and the class of the
descriptor can be verified it actually is assignement compatible with
the requested class. If this would fail, we could still walk the
hierarchy to see, whether we find another classdescriptor. What do you
think of this modification to the algorithm ? 

Regards
Felix


Re: [ocm] mapping selection

Posted by Felix Meschberger <fm...@gmail.com>.
Hi,

Am Mittwoch, den 26.09.2007, 09:25 +0200 schrieb Christophe Lombart:
> Right now, I don't see a problem. That looks even better . Can you check if
> the different possiblities are cover in the unit tests ?

Alright, doing the JIRA and yes, I will check the unit tests.

Thanks and Regards
Felix

> 
> Thanks
> Christophe
> 
> 
> On 9/26/07, Felix Meschberger <fm...@gmail.com> wrote:
> >
> > Hi,
> >
> > When a node is mapped by calling the ObjectConverter.getObject(Session,
> > Class, String) method and no discriminator property is configured the
> > ObjectConverterImpl class tries to find a "best" mapping for the
> > effective node. This is done by walking the class descriptor hierarchy
> > starting at the descriptor for the selected class until a mapping for
> > the node type is found.
> >
> > In case the class descriptor hierarchy is incomplete because an
> > improperly defined class descriptor would actually perfectly map the
> > node but is not declared to extend (or implement) its parent
> > classes/interfaces, the hierarchy walk down will not find the mapping
> > and thus in the end, the originally requested class will be
> > instantiated. If the class is abstract or an interface this of course
> > fails.
> >
> > If an exact class descriptor for the node type would be looked up
> > directly, the mapping might be found immediately and the class of the
> > descriptor can be verified it actually is assignement compatible with
> > the requested class. If this would fail, we could still walk the
> > hierarchy to see, whether we find another classdescriptor. What do you
> > think of this modification to the algorithm ?
> >
> > Regards
> > Felix
> >
> >


Re: [ocm] mapping selection

Posted by Christophe Lombart <ch...@gmail.com>.
Right now, I don't see a problem. That looks even better . Can you check if
the different possiblities are cover in the unit tests ?

Thanks
Christophe


On 9/26/07, Felix Meschberger <fm...@gmail.com> wrote:
>
> Hi,
>
> When a node is mapped by calling the ObjectConverter.getObject(Session,
> Class, String) method and no discriminator property is configured the
> ObjectConverterImpl class tries to find a "best" mapping for the
> effective node. This is done by walking the class descriptor hierarchy
> starting at the descriptor for the selected class until a mapping for
> the node type is found.
>
> In case the class descriptor hierarchy is incomplete because an
> improperly defined class descriptor would actually perfectly map the
> node but is not declared to extend (or implement) its parent
> classes/interfaces, the hierarchy walk down will not find the mapping
> and thus in the end, the originally requested class will be
> instantiated. If the class is abstract or an interface this of course
> fails.
>
> If an exact class descriptor for the node type would be looked up
> directly, the mapping might be found immediately and the class of the
> descriptor can be verified it actually is assignement compatible with
> the requested class. If this would fail, we could still walk the
> hierarchy to see, whether we find another classdescriptor. What do you
> think of this modification to the algorithm ?
>
> Regards
> Felix
>
>