I actually am ok with hiding the elements of the list, but I just was giving a simple example. However I'm having some trouble getting the dynamic handler to be used. From the user guide I got that you can use this on collections, and that I could specify whatever I wanted, however, it appears that registering these only works on maps.
If I have the property handler I gave before (the getProperty method was a little wrong in the method it called on Bar, but anyway), and I do: JXPathIntrospector.registerDynamicClass(Bar.class, MyHandler.class); My handler is only used if Bar doesn't extend any collection, or extends a Map collection. If Bar extends say ArrayList, my dynamic handler isn't used, however, if Bar extends HashMap it is used. Can anyone provide some guidance on this? Are handlers only useful on map collections (which seems like a bug not a feature) or do I need to register using some other method / type of handler? Jerry > -----Original Message----- > From: Paul Copeland [mailto:[EMAIL PROTECTED] > > We are using DynamicPropertyHandler similar to the way you have it. It > looks like you will only be able to get the "x' property and not the > elements of the array list. Do you want to hide the list? Maybe you > need a name for the list too so the list can also be accessible to XPath > expressions. > > Vos, Jerry R. wrote: > >public class BarHandler implements DynamicPropertyHandler { > >public Object getProperty(Object object, String propertyName) { > > if (propertyName.equals("x")) { > > return ((Bar) object).getSubContexts(); > > } > > return null; > >} > > > >public String[] getPropertyNames(Object object) { > > return new String[] { "x" }; > >} > > > >public void setProperty(Object object, String propertyName, Object > >value) { > > throw new UnsupportedOperationException(""); > >} > >} > > > >And then something like > >JXPathIntrospector.registerDynamicClass(Bar.class, BarHandler.class); > > > >Anyway, will update with the results of this. If anyone sees an obvious > >problem with that please let me know. > > > >Jerry > > > >>Vos, Jerry R. wrote: > >>>public class Bar extends ArrayList { > >>> public String getX() { return "xValue" } > >>>} > >>> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]