So I have an object Structure like the following:
I have a Person Object which has a list of Friends (named friends in Person) - That list of Friends has a Map (named information) - The map has a Key of 'age' and a value of an string
So I am looking to return one Friend where the age of that friend is equal to lets say 20
public class Person {
private List<Friend> friends;
public List<Friend> getFriends() {
return friends;
}
public void setFriends(List<Friend> friends) {
this.friends = friends;
}
}
public class Friend {
private Map<String, Object> information;
public Map<String, Object> getInformation() {
return information;
}
public void setInformation(Map<String, Object> information) {
this.information = information;
}
}
Here is what I was thinking but couldn't get it to work please let me know if I am missing something
Friend match = (Friend)JXPathContext.newContext(personInput).getValue("friends/information[@name='age' = '20']//friend");