|
Oracle Fusion Middleware Java API Reference for Oracle TopLink 11g Release 1 (11.1.1) B32476-02 |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
oracle.toplink.internal.helper.DatabaseField
oracle.toplink.ox.XMLField
oracle.toplink.ox.XMLUnionField
public class XMLUnionField
Subclass of XMLField for fields that are mapped to unions. Maintains a list of schema types instead of just one single schema type. Schema types can be added using the addSchemaType api. XMLConstants has a list of useful constants including a list of QNames for built-in schema types that can be used when adding schema types.
When reading and writing an element that is mapped with an XMLUnionField, a conversion to each of the schema types on the field (in the order they are specified ) is tried until a conversion is successful. The java type to convert to is based on the list of schema type to java conversion pairs specified on the field. These conversion pairs can be modified using the addXMLConversion api.
Code Sample
In this example the age field could be a date or an int.
XMLUnionField field = new XMLUnionField("age/text()");
field.addSchemaType(XMLConstants.DATE_QNAME);
field.addSchemaType(XMLConstants.INT_QNAME)
XMLField, XMLConstants, Serialized Form| Constructor Summary | |
|---|---|
XMLUnionField()Constructs an XMLUnionField |
|
XMLUnionField(java.lang.String xPath)Constructs an XMLUnionField with the xpath set to the specified xPath |
|
| Method Summary | |
|---|---|
void |
addSchemaType(javax.xml.namespace.QName value)Adds the new type value to the list of types |
java.lang.Class |
getJavaClass(javax.xml.namespace.QName qname)Return the class for a given qualified XML Schema type. |
javax.xml.namespace.QName |
getSchemaType()Return the first schema type in the list of schema types |
java.util.ArrayList |
getSchemaTypes()Return the list of schema types |
void |
setSchemaType(javax.xml.namespace.QName value)Adds the new type value to the list of types |
void |
setSchemaTypes(java.util.ArrayList value)Sets the schema types that this attribute can be mapped to Valid QName schema types can be found on oracle.toplink.ox.XMLConstants |
| Methods inherited from class oracle.toplink.ox.XMLField |
|---|
addConversion, addJavaConversion, addXMLConversion, getLeafElementType, getNamespaceResolver, getXMLType, getXPath, isTypedTextField, removeConversion, removeJavaConversion, removeXMLConversion, setIsTypedTextField, setLeafElementType, setName, setNamespaceResolver, setUsesSingleNode, setXPath, usesSingleNode |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public XMLUnionField()
public XMLUnionField(java.lang.String xPath)
xPath - The xpath expression for the field| Method Detail |
|---|
public java.util.ArrayList getSchemaTypes()
public void setSchemaTypes(java.util.ArrayList value)
value - An ArrayList containing the schema types.XMLConstantspublic void addSchemaType(javax.xml.namespace.QName value)
value - QName to be added to the list of schema typespublic javax.xml.namespace.QName getSchemaType()
getSchemaType in class XMLFieldpublic void setSchemaType(javax.xml.namespace.QName value)
setSchemaType in class XMLFieldvalue - The value to be added to the list of schema typespublic java.lang.Class getJavaClass(javax.xml.namespace.QName qname)
getJavaClass in class XMLFieldqname - The qualified name of the XML Schema type to use as a key in the lookup
|
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||