Reputation: 1807
Let's say we have a person who has a Child and I want to annotate the object reference to only map a specific field in the Child class to the parent object. Which annotation will I be using then?
The xml looks like this:
<Person>
<Child>Peter</Child>
</Person>
POJOs looks like this:
public class Person {
@XmlElement(name = "Child")
private Child child;
}
public class Child {
@XmlElement(name = "Child")
private String name;
}
But this doesnt work at all, I've also tried XmlElementRef etc.
Upvotes: 1
Views: 520