Reputation: 14551
I have a rather large object tree which I want to export to XML. An object named Person is used at several places (as userCreated, userModified of many child entities, as client, etc)
I would like to export an instance of the object tree as XML and JAXB seems the way to do it.
But, I want to avoid annotating dozens of properties with @XmlTransient. On the contrary, I would like to have a central configuration file in which I could specify the children and properties to export.
Is that possible with JAXB?
Or is it not the right tool for the job?
Upvotes: 1
Views: 87
Reputation: 149037
If less than half of the properties are mapped then you can specify @XmlAccessorType(XmlAccessType.NONE)
on the class and then only fields/properties will JAXB Annotations will be mapped to XML.
If you want to configure the mappings by XML the EclipseLink MOXy implementation (I lead this project) offers a mapping file extension you can use.
Upvotes: 1