Vasiliy,
You need to change the visibility of class B from default to public. JXPath
only supports access to public classes.
Let me know if this helps.
- Dmitri
Vasiliy Stashuk <[EMAIL PROTECTED]> wrote:
Hi!
I have problem while accessing java bean properties via JXPath. Consider
following
example.
puvlic class BlaBla {
public static interface Provider {
public String getName();
}
public static abstract class A implements Provider {
}
static class B extends A {
public String getName() {
return "theName";
}
}
public static void main(String[] args) throws Exception {
B b = new B();
JXPathContext ctx = JXPathContext.newContext(b);
System.out.println(ctx.getValue("name"));
}
}
JXPath fails with:
"org.apache.commons.jxpath.JXPathException: Cannot access property:
BlaBla$B.name; No read method"
This is may be a bug in the
ValueUtils.getAccessibleMethodFromInterfaceNest method.
It doesn't get down thru class hierarchy when looking for public accessor
method.
--
All the best,
Vasyl Stashuk
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]