36.3. Generating Java Classes for Simple Types
Overview
globalBindings customization element's mapSimpleTypeDef to true.
Adding the customization
globalBinding element's mapSimpleTypeDef attribute and set its value to true.
Example 36.13. in-Line Customization to Force Generation of Java Classes for SimpleTypes
<schema targetNamespace="http://widget.com/types/widgetTypes"
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
jaxb:version="2.0">
<annotation>
<appinfo>
<jaxb:globalBindings mapSimpleTypeDef="true" />
</appinfo>
</annotation>
...
</schema>Example 36.14. Binding File to Force Generation of Constants
<jaxb:bindings xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
jaxb:version="2.0">
<jaxb:bindings schemaLocation="types.xsd">
<jaxb:globalBindings mapSimpleTypeDef="true" />
<jaxb:bindings>
<jaxb:bindings>Generated classes
Example 36.15. Simple Type for Customized Mapping
<simpleType name="simpleton">
<restriction base="xsd:string">
<maxLength value="10"/>
</restriction>
</simpleType>Example 36.16. Customized Mapping of a Simple Type
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "simpleton", propOrder = {"value"})
public class Simpleton {
@XmlValue
protected String value;
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}
Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.