How to specify XmlAccessorType for use in JAXB xjc-generated classes

I use XML schemas and generate java files with xjc to be used with JAXB. Created java files have the default @XmlAccessorType (XmlAccessType.FIELD). I would like to change this so that the resulting java files have access to PROPTERY access (@XmlAccessorType (XmlAccessType.PROPERTY)) and do not have @ XmlElement / @ XmlAttribute annotations generated at the field level. Is there a way to accomplish this through a bind file?

+4
source share
1 answer

It doesn't seem like you can do this with a snap setting. However, if you want all the generated classes from a single xjc start to have @XmlAccessorType (XmlAccessType.PROPERTY), you can use the propertiesaccessors extension for xjc:

xjc -Xpropertyaccessors ... 

You must use the latest version of xjc because this plugin has not been registered correctly since 2.2.4 .

0
source

All Articles