JAXB Plugins for wsdl2java

🧪Experimental • Since 3.23.0

Embeds XJC plugins from org.jvnet.jaxb:jaxb-plugins for wsdl2java code generation.

Maven coordinates

Create a new project using quarkus-cxf-jaxb-plugins on code.quarkus.io or add these coordinates to your existing project:

<dependency>
    <groupId>io.quarkiverse.cxf</groupId>
    <artifactId>quarkus-cxf-jaxb-plugins</artifactId>
</dependency>

Check the User guide and especially its Dependency management section for more information about writing applications with Quarkus CXF.

Usage

Check the wsdl2java section of User guide for more details about wsdl2java and XJC.

Use this extension if you want to use any of the following XJC plugins in quarkus.cxf.codegen.wsdl2java.xjc or quarkus.cxf.codegen.wsdl2java."named-parameter-sets".xjc:

  • simpleEquals - add deep, reflection-free, runtime-free equals() methods to the generated classes.

  • simpleHashCode - add deep, reflection-free, runtime-free hashCode() methods to the schema-derived classes.

  • equals - generate equals() methods with a pluggable equality strategy.

  • hashCode - generate hashCode() methods with a pluggable hash code strategy.

  • toString - add a reflection-free strategy-based toString() methods to the generated classes.

  • copyable - generate methods for content copying with a pluggable custom copy creation strategy.

  • mergeable - generate merge() methods to merge data from two source objects into this object with a pluggable merge strategy.

  • inheritance - let the generated classes extend certain class or implement certain interfaces.

  • autoInheritance - force global elements or complex types to extend or extend certain class or implement certain interfaces.

  • wildcard - specify wildcard mode (lax, strict or skip) for wildcard properties.

  • setters - generate setters for collection fields. By default, a copy of the passed-in collection is set. Add setters-mode=direct to set the passed in collection instance directly.

  • simplify (untested)

  • enumValue - make enums implement the EnumValue<T> interface allowing generic access to the original enum values.

  • jaxbindex - generate a per-package jaxb.index file listing all of the schema-derived classes in the package.

  • fixJAXB1058 (untested)

  • commons-lang - generate the toString(), hashCode() and equals() methods using Apache commons-lang3.

  • default-value - sets default values of fields based on the schema default attribute.

  • fluent-api - generate a with* method returning the class instance for every set* method that returns void.

  • namespace-prefix - adds @jakarta.xml.bind.annotation.XmlNs annotations to package-info.java files. Those annotations tell JAXB to generate XML schema instances with specific namespace prefixes, instead of the auto-generated (ns1, ns2, …​) prefixes. Definition of those prefixes is done in a JAXB bindings.xml file that needs to be passed via quarkus.cxf.codegen.wsdl2java.bindings or quarkus.cxf.codegen.wsdl2java."named-parameter-sets".bindings.

  • value-constructor - in addition to the default constructor, generate another constructor initializing every field.

  • boolean-getter - name getter methods for boolean fields getXXX() rather than isXXX().

  • camelcase - always use CamelCase style for class names:

    Name example

    XJC default

    CamelCase

    FIRST_NAME

    FIRSTNAME

    FirstName

    FOOBar

    FOOBar

    FooBar

    SSNCode

    SSNCode

    SsnCode

  • xmlElementWrapper (untested) - support @XmlElementWrapper collection generation (without the need of inner class).

  • parentPointer (untested) - adds a field that points to the parent object

  • inject-listener-code - broken, use property-listener from io.quarkiverse.cxf:quarkus-cxf-xjc-plugins instead.