Ce contenu n'est pas disponible dans la langue sélectionnée.
38.3. Generating Java Classes for Simple Types
Overview Copier lienLien copié sur presse-papiers!
globalBindings customization element's mapSimpleTypeDef to true.
Adding the customization Copier lienLien copié sur presse-papiers!
globalBinding element's mapSimpleTypeDef attribute and set its value to true.
Example 38.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 38.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 Copier lienLien copié sur presse-papiers!
Example 38.15. Simple Type for Customized Mapping
<simpleType name="simpleton">
<restriction base="xsd:string">
<maxLength value="10"/>
</restriction>
</simpleType>
Example 38.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;
}
}