oracle.toplink.ox.mappings
Class XMLChoiceCollectionMapping
java.lang.Object
oracle.toplink.mappings.DatabaseMapping
oracle.toplink.ox.mappings.XMLChoiceCollectionMapping
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, oracle.toplink.ox.mappings.XMLMapping
public class XMLChoiceCollectionMapping
- 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 collection of choice or substitution
group elements
The XMLChoiceCollectionMapping is the collection version of the XMLChoiceMapping. This mapping
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 added to the collection.
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 |
XMLChoiceCollectionMapping
public XMLChoiceCollectionMapping()
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()
setContainerPolicy
public void setContainerPolicy(oracle.toplink.internal.queryframework.ContainerPolicy cp)
useCollectionClass
public void useCollectionClass(java.lang.Class concreteContainerClass)
useCollectionClassName
public void useCollectionClassName(java.lang.String concreteContainerClassName)
getChoiceFieldToClassAssociations
public java.util.ArrayList getChoiceFieldToClassAssociations()
setChoiceFieldToClassAssociations
public void setChoiceFieldToClassAssociations(java.util.ArrayList associations)