You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Yann Duponchel <yd...@zurich.ibm.com> on 2003/11/26 18:39:57 UTC

[jxpath] conflict with Map and accessors

Hi,

Assume I have a class Tree which looks like that:

public class Test implements Map {
   [...]
   public Object getFoo();
}

I would expect that xpath such as "foo" would try to evaluate getFoo()
instead of trying get("foo") which might not exist. Because, the problem
is that I can't figure out how to retrieve nodes which are children of
getFoo().

Is this the desired behavior?
Is there a workaround to force the evaluation of getFoo() instead of
get("foo")?

Thanks,

Yann.



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [jxpath] conflict with Map and accessors

Posted by Dmitri Plotnikov <dm...@apache.org>.
At some point in the past I tried to add support for these hybrids to
JXPath, but it was causing many problems, so I gave up.  And that's where it
stands at this point, unfortunately.  If you have a JavaBean that implements
the Map interface, it is treated as a Map and its bean-style properties are
inaccessible via JXPath.  The only solution I can propose is to modify the
get(String) method of the bean so it returns values of its bean-style
properties.

- Dmitri

----- Original Message ----- 
From: "Yann Duponchel" <yd...@zurich.ibm.com>
To: <co...@jakarta.apache.org>
Sent: Wednesday, November 26, 2003 12:39 PM
Subject: [jxpath] conflict with Map and accessors


> Hi,
>
> Assume I have a class Tree which looks like that:
>
> public class Test implements Map {
>    [...]
>    public Object getFoo();
> }
>
> I would expect that xpath such as "foo" would try to evaluate getFoo()
> instead of trying get("foo") which might not exist. Because, the problem
> is that I can't figure out how to retrieve nodes which are children of
> getFoo().
>
> Is this the desired behavior?
> Is there a workaround to force the evaluation of getFoo() instead of
> get("foo")?
>
> Thanks,
>
> Yann.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org