This week's book giveaways are in the Refactoring and Agile forums. We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line! See this thread and this one for details.
i need something that will act like an xmlAdapter, but will be defined on a xmlRootElement (rather than on a field).
the purpose is custom marshalling and unmarshalling of fields which will be determined by the fields values.
for example, if a field value is of a particular syntax, then the field will be changed while unmarshalling .
i have a lot of objects that are serialized to xml files, and a lot of fields that potentially could be changed, and thats why i'm looking for a solution at the rootElement level and not at the field level.
posted 5 years ago
You can specify the @XmlJavaTypeAdapter annotation at the class level. This means that that any property of this particular class will automatically use the adapter. Unfortumately the adapter does not get activated when this object is the root object of the tree. In this case you need to call the adapter yourself.