I have a Product class with the following properties: name , dateCreated , createdByUser , dateModified and modifiedByUser , and I use JAXB sorting. I would like to have this conclusion:
<product> <name>...</name> <auditInfo> <dateCreated>...</dateCreated> <createdByUser>...</createdByUser> <dateModified>...</dateModified> <modifiedByUser>...</modifiedByUser> </auditInfo> </product>
but ideally, I would not want to create a separate AuditInfo wrapper AuditInfo around these properties.
Is there a way to do this using JAXB annotations? I looked at @XmlElementWrapper , but only for collections.
source share