oracle.toplink.ox.mappings
Class XMLChoiceObjectMapping
java.lang.Object
oracle.toplink.mappings.DatabaseMapping
oracle.toplink.ox.mappings.XMLChoiceObjectMapping
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, oracle.toplink.ox.mappings.XMLMapping
public class XMLChoiceObjectMapping
- extends DatabaseMapping
- implements oracle.toplink.ox.mappings.XMLMapping
Purpose:Provide a mapping that can map a single attribute to a number of
different elements in an XML Document. This will be used to map to Choices or Substitution
Groups in an XML Schema
Responsibilities:
- Allow the user to specify XPath -> Type mappings
- Handle reading and writing of XML Documents containing a single choice or substitution
group element
The XMLChoiceMapping allows the user to specify a number of different xpaths, and types associated with those xpaths.
When any of these elements are encountered in the XML Document, they are read in as the correct
type and set in the object.
Setting up XPath mappings:Unlike other OXM Mappings, instead of setting a single xpath,
the addChoiceElement method is used to specify an xpath and the type assocated with this xpath.
xmlChoiceCollectionMapping.addChoiceElement("mystring/text()", String.class);
xmlChoiceCollectionMapping.addChoiceElement("myaddress", Address.class);
- See Also:
- Serialized Form
Methods inherited from class oracle.toplink.mappings.DatabaseMapping |
getAttributeAccessor, getAttributeClassification, getAttributeName, getGetMethodName, getProperty, getReferenceDescriptor, getSetMethodName, isLazy, isOptional, isUsingMethodAccess, readOnly, readWrite, setAttributeAccessor, setAttributeName, setGetMethodName, setIsLazy, setIsOptional, setIsReadOnly, setProperty, setSetMethodName, setWeight, simpleAddToCollectionChangeRecord, simpleRemoveFromCollectionChangeRecord |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
XMLChoiceObjectMapping
public XMLChoiceObjectMapping()
addChoiceElement
public void addChoiceElement(java.lang.String xpath,
java.lang.Class elementType)
addChoiceElement
public void addChoiceElement(XMLField xmlField,
java.lang.Class elementType)
addChoiceElement
public void addChoiceElement(java.lang.String xpath,
java.lang.String elementTypeName)
addChoiceElement
public void addChoiceElement(XMLField xmlField,
java.lang.String elementTypeName)
getFieldToClassMappings
public java.util.Map<XMLField, java.lang.Class> getFieldToClassMappings()
getClassToFieldMappings
public java.util.Map<java.lang.Class, XMLField> getClassToFieldMappings()
getChoiceElementMappings
public java.util.Map<XMLField, oracle.toplink.ox.mappings.XMLMapping> getChoiceElementMappings()
getChoiceFieldToClassAssociations
public java.util.ArrayList getChoiceFieldToClassAssociations()
setChoiceFieldToClassAssociations
public void setChoiceFieldToClassAssociations(java.util.ArrayList associations)