Oracle Fusion Middleware Java API Reference for Oracle TopLink
11g Release 1 (11.1.1)

B32476-03

oracle.toplink.ox.mappings
Class XMLChoiceObjectMapping

java.lang.Object
  extended by oracle.toplink.mappings.DatabaseMapping
      extended by 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:

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

Constructor Summary
XMLChoiceObjectMapping()
           
 
Method Summary
 void addChoiceElement(java.lang.String xpath, java.lang.Class elementType)
           
 void addChoiceElement(java.lang.String xpath, java.lang.String elementTypeName)
           
 void addChoiceElement(XMLField xmlField, java.lang.Class elementType)
           
 void addChoiceElement(XMLField xmlField, java.lang.String elementTypeName)
           
 java.util.Map<XMLField, oracle.toplink.ox.mappings.XMLMapping> getChoiceElementMappings()
           
 java.util.ArrayList getChoiceFieldToClassAssociations()
           
 java.util.Map<java.lang.Class, XMLField> getClassToFieldMappings()
           
 java.util.Map<XMLField, java.lang.Class> getFieldToClassMappings()
           
 void setChoiceFieldToClassAssociations(java.util.ArrayList associations)
           
 
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
 

Constructor Detail

XMLChoiceObjectMapping

public XMLChoiceObjectMapping()
Method Detail

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)

Copyright © 1998, 2010, Oracle. All Rights Reserved.