IBM WebSphere Adapters Network Card User Manual


 
Table 2. Mapping between built-in XSD schema and JavaBean properties (continued)
Header Header
anySimpleType String
Any String
There are cases in which a simple XML data type must be mapped to the
corresponding Java wrapper class for the Java primitive type:
v an element declaration with the nillable attribute set to True
v an element declaration with the minOccurs attribute set to 0 (zero) and the
maxOccurs attribute set to 1 (one) or absent
v an attribute declaration with the use attribute set to optional or absent and
carrying neither the default nor the fixed attribute
The following shows examples of each:
v
<xsd:element name="code" type="xsd:int" nillable="true"/>
v <xsd:element name="code2" type="xsd:int" minOccurs=""></xsd:element>
v <xsd:element name="">
<xsd:complexType>
<xsd:sequence/>
<xsd:attribute name="">
</xsd:attribute></xsd:complexType>
</xsd:element>
The element/attribute declarations for code, code2, code3 above are all mapped to
the java.lang.Integer type.
JavaBean Metadata ASI format: The metadata is derived mostly from the structure of
the bean. Other metadata, such as containedType and maxLength are not normal
parts of a JavaBean structure, so they must be part of the annotation maps.
Annotation maps:
Annotations are not normally part of a JavaBean structure, so JavaBeanRecords
must contain annotations in a specific format to be usable by the metadata API.
The JavaBeanRecord must implement the BeanMetadata interface.
public interface BeanMetadata {
public Map getObjectAnnotations();
public Map getPropertyAnnotations();
public Set getSetAttributes();
}
Each property (if it needs metadata) will have its own Map, which will be stored
in the propertyAnnotations map, using the property name as key.
Reserved keys in the propertyAnnotations map:
v ContainedType
The class of the object that this property contains
v PrimaryKey:
Whether this property is key
v DefaultValue:
The default value
v MaxLength:
The maximum length of this property.
116 WebSphere Adapters: WebSphere Adapter Toolkit User Guide