Fuse 6 is no longer supported
As of February 2025, Red Hat Fuse 6 is no longer supported. If you are using Fuse 6, please upgrade to Red Hat build of Apache Camel.37.3. Generating Java Classes for Simple Types
Overview Copy linkLink copied to clipboard!
Copy linkLink copied to clipboard!
By default, named simple types do not result in generated types unless they are enumerations. Elements defined using a simple type are mapped to properties of a Java primitive type.
There are instances when you need to have simple types generated into Java classes, such as is when you want to use type substitution.
To instruct the code generators to generate classes for all globally defined simple types, set the
globalBindings customization element's mapSimpleTypeDef to true.
Adding the customization Copy linkLink copied to clipboard!
Copy linkLink copied to clipboard!
To instruct the code generators to create Java classes for named simple types add the
globalBinding element's mapSimpleTypeDef attribute and set its value to true.
Example 37.13, “in-Line Customization to Force Generation of Java Classes for SimpleTypes” shows an in-line customization that forces the code generator to generate Java classes for named simple types.
Example 37.13. in-Line Customization to Force Generation of Java Classes for SimpleTypes
Example 37.14, “Binding File to Force Generation of Constants” shows an external binding file that customizes the generation of simple types.
Example 37.14. Binding File to Force Generation of Constants
Important
This customization only affects named simple types that are defined in the global scope.
Generated classes Copy linkLink copied to clipboard!
Copy linkLink copied to clipboard!
The class generated for a simple type has one property called value. The value property is of the Java type defined by the mappings in Section 33.1, “Primitive Types”. The generated class has a getter and a setter for the value property.
Example 37.16, “Customized Mapping of a Simple Type” shows the Java class generated for the simple type defined in Example 37.15, “Simple Type for Customized Mapping”.
Example 37.15. Simple Type for Customized Mapping
<simpleType name="simpleton">
<restriction base="xsd:string">
<maxLength value="10"/>
</restriction>
</simpleType>
<simpleType name="simpleton">
<restriction base="xsd:string">
<maxLength value="10"/>
</restriction>
</simpleType>
Example 37.16. Customized Mapping of a Simple Type