Hi Matt ,
Thanks for reply.
Yes, your alternative solutions definitely will work,
But, I'm not sure it's a good idea to make the JXPath support Boolean?
or do we have a plan to support Boolean?
And anther related question is that, do we have a plan to support new
features in JDK5, e.g Generics, Annotation etc.?
Thanks,
James.
--- maomaode <[EMAIL PROTECTED]> wrote:
Hi,
I'm a new user of JXPath, my working env: JDK5,
JXPath 1.2
I have a Nested bean class:
Config.java which has a getter:
CacheConfig getCache() {
return this.cache;
}
The CacheConfig.java which has two getters:
Boolean isEnable() {
return this.enable;
}
String getDir() {
return this.dir
}
So my simple test code is:
JXPathContext context =
JXPathContext.newContext(config);
context.getValue("/cache/dir");
This one works perfectly
But, Unfortunately,
context.getValue("/cache/enable");
what i got is :
org.apache.commons.jxpath.JXPathException: Cannot
access property:
config.CacheConfig.enable
o read method
at
org.apache.commons.jxpath.util.ValueUtils.getValue(ValueUtils.java:348)
at
org.apache.commons.jxpath.ri.model.beans.BeanPropertyPointer.getBaseValue(BeanPropertyPointer.java:108)
at
org.apache.commons.jxpath.ri.model.beans.BeanPropertyPointer.getImmediateNode(BeanPropertyPointer.java:135)
at
org.apache.commons.jxpath.ri.model.beans.PropertyPointer.getImmediateValuePointer(PropertyPointer.java:127)
at
org.apache.commons.jxpath.ri.model.NodePointer.getValuePointer(NodePointer.java:238)
at
org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.getValue(JXPathContextReferenceImpl.java:331)
at
org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.getValue(JXPathContextReferenceImpl.java:280)
So, i wondering, the JXPath only support get***, not
the is***?
I have raised a jira bug[1], i got a quick
response, thanks, BTW
The answer is JXPath do support is*** feature, so i
guess i must misuse
the JXPath, or the version is not correct?
Can someone help me out? just tell me how to
retrieve the
boolean/Boolean value from the beans, or tell me
where is the unit test
code.
TBH, i can not find the test case which include
isFoo() mentioned in the
jira response.
mmm... my guess would be that java.beans.introspector
does not count Booleans, which are Objects, as being
eligible for the isFoo() naming convention, only
boolean primitives. The javadoc of
java.beans.PropertyDescriptor's (String, Class)
constructor possibly implies this. All I can tell you
is to use a primitive or take it up with Sun to have
Boolean isFoo() recognized. OR... you could change
your isEnable() to getEnable(), or simply add
getEnable() as an alternate form of getEnable()--one
that will just happen to be recognized by jxpath.
-Matt
Thanks in advance
James.
[1]https://issues.apache.org/jira/browse/JXPATH-78?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
---------------------------------------------------------------------
To unsubscribe, e-mail:
[EMAIL PROTECTED]
For additional commands, e-mail:
[EMAIL PROTECTED]
____________________________________________________________________________________
TV dinner still cooling?
Check out "Tonight's Picks" on Yahoo! TV.
http://tv.yahoo.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]