JAXB XML ElementWrapper Plugin - highsource/jaxb-tools GitHub Wiki
When generating XML schema from Java source code using the schemagen tool a common approach is to use
the @XmlElementWrapper and @XmlElement annotations to handle schema generation for collections.
However, when generating Java source from a schema using the xjc tool the resulting code is not created with these annotations.
Instead, the generated Java source contains "injected" inner classes to accommodate the collection of elements contained within an element.
This plugins solve this by generating the corresponding @XmlElementWrapper annotation on corresponding fields to remove the need of nested inner classes.
Added in 4.0.1 version of JAXB-Tools.
- Activate the plugin using the
-XelementWrapperswitch.
You can also use the following switches to change the plugin behaviour :
-
-XelementWrapper:delete: remove generated inner class from output - if not specified, inner class generated are kept -
-XelementWrapper:include <file>: specify candidates classes in file to proceed -
-XelementWrapper:exclude <file>: specify candidates classes in file to ignore -
-XelementWrapper:summary <file>: output the summary of operation in specified file -
-XelementWrapper:collection <classname>: specify theclassnamefor collections - defaults tojava.util.ArrayList -
-XelementWrapper:instantiate <EAGER/LAZY>: specify if field is initializedEAGER(field = new ...) orLAZY(if (field == null) field = new ...) - defaults toEAGER