1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Schema Datatype Handling</title>
</head>
<body class="composite">
<div id="bodycol">
<div class="app">
<div class="h3">
<h3><a name="types"></a>Schema datatypes</h3>
<p>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 <code>java.lang.String</code>.</p>
<h4>Default representations of schema datatypes</h4>
<table cellpadding="3" cellspacing="2" border="1" width="100%">
<tr class="b">
<th>Schema type</th>
<th>Primitive type</th>
<th>Object type</th>
</tr>
<tr class="a">
<td>xs:base64Binary</td>
<td/>
<td><code>byte[]</code></td>
</tr>
<tr class="b">
<td>xs:boolean</td>
<td><code>boolean</code></td>
<td><code>java.lang.Boolean</code></td>
</tr>
<tr class="a">
<td>xs:byte</td>
<td><code>byte</code></td>
<td><code>java.lang.Byte</code></td>
</tr>
<tr class="b">
<td>xs:date</td>
<td/>
<td><code>java.sql.Date</code></td>
</tr>
<tr class="a">
<td>xs:dateTime</td>
<td/>
<td><code>java.util.Date</code></td>
</tr>
<tr class="b">
<td>xs:decimal</td>
<td/>
<td><code>java.math.BigDecimal</code></td>
</tr>
<tr class="a">
<td>xs:double</td>
<td><code>double</code></td>
<td><code>java.lang.Double</code></td>
</tr>
<tr class="b">
<td>xs:float</td>
<td><code>float</code></td>
<td><code>java.lang.Float</code></td>
</tr>
<tr class="a">
<td>xs:hexbinary</td>
<td/>
<td><code>byte[]</code></td>
</tr>
<tr class="b">
<td>xs:int</td>
<td><code>int</code></td>
<td><code>java.lang.Integer</code></td>
</tr>
<tr class="a">
<td>xs:long</td>
<td><code>long</code></td>
<td><code>java.lang.Long</code></td>
</tr>
<tr class="b">
<td>xs:short</td>
<td><code>short</code></td>
<td><code>java.lang.Short</code></td>
</tr>
<tr class="b">
<td>xs:QName</td>
<td/>
<td><code>org.jibx.runtime.QName</code></td>
</tr>
<tr class="a">
<td>all others</td>
<td/>
<td><code>java.lang.String</code></td>
</tr>
</table>
<p>To change these defaults, you can use the <a href="%cgextends%#types">schema-type</a>
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
<a href="%cgcustoms%#type-substitutions">type-substitutions</a> nesting customization
attribute (as in the <a href="%cgexample2%">More Customizations</a> example).</p>
</div>
</div>
</div>
</body>
</html>
|