Hi all,
I'm using JXPath 1.2, and I want to get null value from a JavaBean,
but not successful.
If a property is java.lang.String type, I can get null value,
but do not get null value in a final modifer type
(for example, Date type and Object type).
The following is a sample.
----------------------------------------------------------
/* ******* JavaBean ******* */
public class Employee {
private Object firstName;
private String secondName;
public Object getFirstName() {
return firstName;
}
public String getSecondName() {
return secondName;
}
......
}
/* ******* Access String Type ******* */
Employee emp = new Employee();
emp.setSecondName(null);
JXPathContext context = JXPathContext.newContext(emp);
Iterator itr = context.iteratePointers("/secondName");
// hasNext ---> true
while (itr.hasNext()) {
// Invoked and get null value.
Pointer p = (Pointer) itr.next();
System.out.println("'secondName' value --- " + p.getValue());
}
// This cord outputs the following messages.
// 'secondName' value --- null
/* ******* Access Object Type ******* */
Employee emp = new Employee();
emp.setFirstName(null);
JXPathContext context = JXPathContext.newContext(emp);
Iterator itr = context.iteratePointers("/firstName");
// hasNext() ---> false
// I think that there should be one null value...
while (itr.hasNext()) {
// Not Invoked.
Pointer p = (Pointer) itr.next();
System.out.println("'firstName' value --- " + p.getValue());
}
// This cord outputs nothing.
----------------------------------------------------------
When I take an element of Map, a similar problem happens.
Would you teach me a good method to solve this problem?
Regards,
Shohei Aoki
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]