Schema Datatype Handling

# Schema Datatype Handling |

JiBX Basics Overview Getting Started Binding Compiler Binding on Load Runtime Extras Building JiBX Maven Contributing License News and Status Support FAQ Mailing Lists Bugs User Comments Sponsors Start from Code Start from Code BindGen Example Code Example 1 Example 2 Example 3 Example 4 Customizations Reference SchemaGen Jibx2Wsdl Examples Customizations Start from Schema Start from Schema CodeGen Schema Datatype Handling Example Code Default Generation Simple Customizations More Customizations Modular Generation Customizations Reference Extensions Reference Binding Definition Binding Tutorial A basic binding Binding extras Structure mapping Collections and arrays Using mappings Advanced binding Method hooks Custom code Precompiled Bindings Definition details Definition contexts Conversions Date/time conversions XML summary <binding> element <include> element <format> element <namespace> element <mapping> element <value> element <structure> element <collection> element Attribute groups Usage API Runtime JavaDocs Subprojects Eclipse Plug-in Introduction Install Usage JiBX/WS Axis2 Usage JiBX/OTA Schema Library | ### Schema datatypes CodeGen uses standard Java types to represent the most-commonly-used schema datatypes, as listed below. In case where both a primitive type and an object type are used to represent a schema datatype, the primitive type is used for required values while the object type is used for optional values. As shown in the table, all schema types with no specific Java equivalent are handled using `java.lang.String`. #### Default representations of schema datatypes
Schema type | Primitive type | Object type
--- | --- | ---
xs:base64Binary |  | `byte[]`
xs:boolean | `boolean` | `java.lang.Boolean`
xs:byte | `byte` | `java.lang.Byte`
xs:date |  | `java.sql.Date`
xs:dateTime |  | `java.util.Date`
xs:decimal |  | `java.math.BigDecimal`
xs:double | `double` | `java.lang.Double`
xs:float | `float` | `java.lang.Float`
xs:hexbinary |  | `byte[]`
xs:int | `int` | `java.lang.Integer`
xs:long | `long` | `java.lang.Long`
xs:short | `short` | `java.lang.Short`
xs:QName |  | `org.jibx.runtime.QName`
all others |  | `java.lang.String`
To change these defaults, you can use the schema-type code generation extension element to change the Java representation of a schema type, the way the type is serialized and deserialized, or both. You can also substitute one schema type (or user type) for another using the type-substitutions nesting customization attribute (as in the More Customizations example).