@XmlType
@XmlAccessorType(XmlAccessType.FIELD) // here I need this access
public class User implements Serializable
{
//...
@XmlTransient
private Set<Values> values;
//..
@XmlElement
private Set<History> getXmlHistory()
{
return new CustomSet<Values, History>(Values);
}
private void setXmlHistory(final Set<History> aHistory)
{
this.values = new HashSet<Values>();
}
}
When I am create User object in Java code and after create XML, then all normally.
But when I try to get User-object from XML, then field values
always null
. So setter not working here. May be setter needs some annotation too?
XML looks like
<user>
...
<xmlHistory>
// ... record 1
</xmlHistory>
<xmlHistory>
// ... record 2
</xmlHistory>
</user>
No comments:
Post a Comment