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
.
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).