-
Notifications
You must be signed in to change notification settings - Fork 99
JAXB XML ElementWrapper Plugin
Laurent Schoelens edited this page Dec 6, 2023
·
1 revision
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
-XelementWrapper
switch.
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 theclassname
for collections - defaults tojava.util.ArrayList
-
-XelementWrapper:instantiate <EAGER/LAZY>
: specify if field is initializedEAGER
(field = new ...) orLAZY
(if (field == null) field = new ...
) - defaults toEAGER
- Home
- Migration guide
-
JAXB Maven Plugin
- Quick Start
-
User Guide
- Basic Usage
- Specifying What To Compile
- Referencing Resources in Maven Artifacts
- Using Catalogs
- Using Episodes
- Modular Schema Compilation
- Controlling the Output
- Using JAXB Plugins
- Using a Specific JAXB Version
- Configuring Extension, Validation and XML Security
- IDE Integration
- Miscellaneous
- Configuring Proxies
- Maven Documentation
- Configuration Cheat Sheet
- Common Pitfalls and Problems
-
JAXB2 Basics Plugins
- Using JAXB2 Basics Plugins
- JSR-305 Support
-
JAXB2 Basics Plugins List
- SimpleEquals Plugin
- SimpleHashCode Plugin
- Equals Plugin
- HashCode Plugin
- ToString Plugin
- Copyable Plugin
- Mergeable Plugin
- Inheritance Plugin
- AutoInheritance Plugin
- Wildcard Plugin
- Setters Plugin
- Simplify Plugin
- EnumValue Plugin
- JAXBIndex Plugin
- FixJAXB1058 Plugin
- Commons Lang Plugin
- Default Value Plugin
- Fluent API Plugin
- Namespace Prefix Plugin
- Value Constructor Plugin
- Boolean Getter Plugin
- CamelCase Plugin
- XML ElementWrapper Plugin
- Parent Pointer Plugin
- Property Listener Injector Plugin
- Annox
- JAXB Annotate Plugin
-
HyperJAXB3
- Build System Support
- Customization Guide
- Databases
- Development guide
- Extension guide
- FAQ
- IDE Support
- Java Persistence
- JAXB
- JDK Support
- Project Templates
-
Reference
- Adding vendor-specific annotations
- Features
- Integrating Hyperjaxb3 in builds
- Introduction
- Making schema-derived classes ready for JPA
- Adding required properties
- Applying workarounds for JAXB vs. JPA conflicts
- Enforcing top-level classes
- Generating equals and hashCode methods
- Generating ORM metadata
- Generating persistence unit descriptor
- JPA 2 Support
- Making classes serializable
- Testing generated mappings
- Reference - single page
- Related Projects
- Sample projects
- Solutions
- Target Scenarios
- Test Projects
- Tutorials
- Best Practices
- FAQ
- Sample Projects
- Support
- License
- Distribution