JXPathContext on java Objects
By Vincent DEMAY, Monday 4 June 2007 :: Java :: #62 :: rss
JxPath is a very usefull API to manipulate XML. But you can also use it to navigate an modify Java object : JXPathContext for java object
public class Employee { public Address getHomeAddress(){ ... } } public class Address { public String getStreetNumber(){ ... } } Employee emp = new Employee(); ... JXPathContext context = JXPathContext.newContext(emp); String sNumber = (String)context.getValue("homeAddress/streetNumber");
A very good way to make introspection...
Power by
Comments
No comment.
Add a comment