Most likely your problem is not with generics, but simply with the fact that 
JXPath has a hard time using a collection as its root.  The easiest workaround 
is to use some parent object to hold a reference to your container.

HTH,
Matt


--- On Sun, 2/8/09, Andrew Hughes <[email protected]> wrote:

> From: Andrew Hughes <[email protected]>
> Subject: JXPath over Generic Collection<?>, How?
> To: "Commons Users List" <[email protected]>
> Date: Sunday, February 8, 2009, 5:09 PM
> Hi All,
> Hopefully the solution is as easy as the question. I would
> like to perform
> evaluation on a (very simple) generic collection... as you
> can see below
> (HeirarchyPojo). I should be able to ask for a
> HeirarchyPojo's with
> name='Bill' or the 3rd Child... The problem is that
> nothing ever evaluate on
> this data structure. What's the deal with Generic
> Collections and JXPath?
> 
> p.s this is not in the userguide and would be a most
> welcomed addition (if
> we can nut this out with your help).
> 
> Cheers.
> 
> 
> package xpath.and.generics;
> 
> import java.util.ArrayList;
> 
> public class HeirarchyPojo extends
> ArrayList<HeirarchyPojo>{
> 
>     public HeirarchyPojo(){}
> 
>     private String id;
>     private String name;
> 
>     public String getId() {
>         return id;
>     }
> 
>     public void setId(String id) {
>         this.id = id;
>     }
> 
>     public String getName() {
>         return name;
>     }
> 
>     public void setName(String name) {
>         this.name = name;
>     }
> 
> }


      

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to