Top Description Fields Constructors Methods
org.eclipse.persistence.oxm.mappings

public Class XMLChoiceCollectionMapping

extends DatabaseMapping
implements ChoiceCollectionMapping<AbstractSession, AttributeAccessor, ContainerPolicy, Converter, ClassDescriptor, DatabaseField, XMLMarshaller, Session, XMLUnmarshaller, XMLField, XMLMapping, XMLRecord>, XMLMapping
Class Inheritance
All Implemented Interfaces
org.eclipse.persistence.oxm.mappings.XMLMapping, org.eclipse.persistence.internal.oxm.mappings.Mapping, org.eclipse.persistence.internal.oxm.mappings.ChoiceCollectionMapping, org.eclipse.persistence.internal.oxm.mappings.XMLConverterMapping, org.eclipse.persistence.internal.oxm.mappings.XMLContainerMapping
Imports
java.security.AccessController, .PrivilegedActionException, java.util.ArrayList, .HashMap, .Iterator, .LinkedHashMap, .List, .Map, .Set, .Map.Entry, .Vector, javax.xml.namespace.QName, org.eclipse.persistence.descriptors.ClassDescriptor, org.eclipse.persistence.exceptions.DatabaseException, .DescriptorException, .ValidationException, org.eclipse.persistence.internal.descriptors.DescriptorIterator, .InstanceVariableAttributeAccessor, org.eclipse.persistence.internal.helper.ClassConstants, .DatabaseField, org.eclipse.persistence.internal.identitymaps.CacheKey, org.eclipse.persistence.internal.oxm.NodeValue, .XMLChoiceFieldToClassAssociation, .XMLConversionManager, .XPathFragment, org.eclipse.persistence.internal.oxm.mappings.ChoiceCollectionMapping, .Field, .XMLContainerMapping, org.eclipse.persistence.internal.queries.CollectionContainerPolicy, .ContainerPolicy, .JoinedAttributeManager, org.eclipse.persistence.internal.security.PrivilegedAccessHelper, .PrivilegedClassForName, org.eclipse.persistence.internal.sessions.AbstractRecord, .AbstractSession, .ChangeRecord, .MergeManager, .ObjectChangeSet, .UnitOfWorkImpl, org.eclipse.persistence.internal.sessions.remote.ObjectDescriptor, org.eclipse.persistence.mappings.AttributeAccessor, .DatabaseMapping, org.eclipse.persistence.mappings.converters.Converter, org.eclipse.persistence.mappings.foundation.AbstractCompositeCollectionMapping, .AbstractCompositeDirectCollectionMapping, org.eclipse.persistence.oxm.XMLField, .XMLMarshaller, .XMLRoot, .XMLUnmarshaller, org.eclipse.persistence.oxm.mappings.converters.XMLConverter, org.eclipse.persistence.oxm.mappings.nullpolicy.AbstractNullPolicy, org.eclipse.persistence.oxm.record.DOMRecord, .XMLEntry, .XMLRecord, org.eclipse.persistence.queries.ObjectBuildingQuery, .ObjectLevelReadQuery, org.eclipse.persistence.sessions.Session, org.eclipse.persistence.sessions.remote.DistributedSession

PUBLIC:

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 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 associated with this xpath.
xmlChoiceCollectionMapping.addChoiceElement("mystring/text()", String.class);
xmlChoiceCollectionMapping.addChoiceElement("myaddress", Address.class);

Field Summary

Modifier and TypeField and Description
private XMLAnyCollectionMapping
private Map<XMLField, XMLMapping>
private Map<Class<?>, XMLMapping>
private Map<String, XMLMapping>
private Map<String, XMLField>
private Map<String, List<XMLField>>
private Map<Class<?>, XMLField>
private Map<Class<?>, List<XMLField>>
private ContainerPolicy
private Converter
private static final String
private Map<XMLField, Converter>
private Map<XMLField, Class<?>>
private Map<XMLField, String>
private static final String
private boolean
private boolean
private boolean
private boolean
private static final String
private XMLCompositeDirectCollectionMapping
private String
private boolean
private static final AttributeAccessor
private AbstractNullPolicy
Inherited from org.eclipse.persistence.mappings.DatabaseMapping:
attributeAccessorattributeNamederivedIdMappingderivesIddescriptorfieldsisCacheableisInSopObjectisJPAIdisLazyisMapKeyMappingisOptionalisPrimaryKeyMappingisReadOnlyisRemotelyInitializedmapsIdValueNO_FIELDSNO_WEIGHTpropertiesunconvertedPropertiesweightWEIGHT_AGGREGATEWEIGHT_DIRECTWEIGHT_TO_ONEWEIGHT_TRANSFORM

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
addChoiceElement(String xpath, Class<?> elementType)

public void
public void
addChoiceElement(XMLField xmlField, Class<?> elementType)

public void
addChoiceElement(List<XMLField> srcFields, Class<?> elementType, List<XMLField> tgtFields)

public void
public void
addChoiceElement(String srcXPath, Class<?> elementType, String tgtXPath)

public void
public void
addChoiceElement(XMLField sourceField, Class<?> elementType, XMLField targetField)

public void
private void
addChoiceElementMapping(List<XMLField> sourceFields, Class<?> theClass, List<XMLField> targetFields)

private void
addChoiceElementMapping(List<XMLField> sourceFields, String theClass, List<XMLField> targetFields)

private void
addChoiceElementMapping(XMLField sourceField, Class<?> theClass, XMLField targetField)

private void
addChoiceElementMapping(XMLField sourceField, String className, XMLField targetField)

private void
private void
addChoiceElementMapping(XMLField xmlField, Class<?> theClass)

public void
public void
buildBackupClone(Object
TODO
clone
,
Object
TODO
backup
,
UnitOfWorkImpl
TODO
unitOfWork
)

Implements abstract org.eclipse.persistence.mappings.DatabaseMapping.buildBackupClone.

INTERNAL: Clone the attribute from the clone and assign it to the backup.
public void
buildClone(Object
TODO
original
,
CacheKey
TODO
cacheKey
,
Object
TODO
clone
,
Integer
TODO
refreshCascade
,
AbstractSession
TODO
cloningSession
)

Implements abstract org.eclipse.persistence.mappings.DatabaseMapping.buildClone.

INTERNAL: Clone the attribute from the original and assign it to the clone.
public void
buildCloneFromRow(AbstractRecord
TODO
databaseRow
,
JoinedAttributeManager
TODO
joinManager
,
Object
TODO
clone
,
CacheKey
TODO
sharedCacheKey
,
ObjectBuildingQuery
TODO
sourceQuery
,
UnitOfWorkImpl
TODO
unitOfWork
,
AbstractSession
TODO
executionSession
)

Implements abstract org.eclipse.persistence.mappings.DatabaseMapping.buildCloneFromRow.

INTERNAL: A combination of readFromRowIntoObject and buildClone.
public void
cascadePerformRemoveIfRequired(Object
TODO
object
,
UnitOfWorkImpl
TODO
uow
,
Map<K, V>
TODO
visitedObjects
)

Implements abstract org.eclipse.persistence.mappings.DatabaseMapping.cascadePerformRemoveIfRequired.

INTERNAL: Cascade perform delete through mappings that require the cascade
public void
cascadeRegisterNewIfRequired(Object
TODO
object
,
UnitOfWorkImpl
TODO
uow
,
Map<K, V>
TODO
visitedObjects
)

Implements abstract org.eclipse.persistence.mappings.DatabaseMapping.cascadeRegisterNewIfRequired.

INTERNAL: Cascade registerNew for Create through mappings that require the cascade
protected Vector<DatabaseField>
collectFields()

Overrides org.eclipse.persistence.mappings.DatabaseMapping.collectFields.

This method must be overwritten in the subclasses to return a vector of all the fields this mapping represents.
public ChangeRecord

Returns:

prototype.changeset.ChangeRecord
compareForChange
(Object
TODO
clone
,
Object
TODO
backup
,
ObjectChangeSet
TODO
owner
,
AbstractSession
TODO
session
)

Implements abstract org.eclipse.persistence.mappings.DatabaseMapping.compareForChange.

INTERNAL: This method was created in VisualAge.
public boolean
compareObjects(Object
TODO
firstObject
,
Object
TODO
secondObject
,
AbstractSession
TODO
session
)

Implements abstract org.eclipse.persistence.mappings.DatabaseMapping.compareObjects.

INTERNAL: Compare the attributes belonging to this mapping for the objects.
public void
convertClassNamesToClasses(ClassLoader
TODO
classLoader
)

Overrides org.eclipse.persistence.mappings.DatabaseMapping.convertClassNamesToClasses.

Implements org.eclipse.persistence.internal.oxm.mappings.Mapping.convertClassNamesToClasses, org.eclipse.persistence.oxm.mappings.XMLMapping.convertClassNamesToClasses.

INTERNAL: Convert all the class-name-based settings in this mapping to actual class-based settings This method is implemented by subclasses as necessary.
public Object
public Object
public void
fixObjectReferences(Object
TODO
object
,
Map<Object, ObjectDescriptor>
TODO
objectDescriptors
,
Map<Object, Object>
TODO
processedObjects
,
ObjectLevelReadQuery
TODO
query
,
DistributedSession
TODO
session
)

Implements abstract org.eclipse.persistence.mappings.DatabaseMapping.fixObjectReferences.

INTERNAL: An object has been serialized from the server to the client.
public XMLAnyCollectionMapping
public Map<XMLField, XMLMapping>
public Map<Class<?>, XMLMapping>
public ArrayList<E>
public Map<String, XMLField>
private Map<String, List<XMLField>>
public Map<Class<?>, XMLField>
public Map<Class<?>, List<XMLField>>
public ContainerPolicy
public Converter
public Converter
private XMLField
getFieldForName(String localName, String namespaceUri)

public Vector<DatabaseField>
getFields()

Overrides org.eclipse.persistence.mappings.DatabaseMapping.getFields.

INTERNAL: Returns a vector of all the fields this mapping represents.
public Map<XMLField, Class<?>>
public XMLCompositeDirectCollectionMapping
public boolean
getReuseContainer()

Implements org.eclipse.persistence.internal.oxm.mappings.XMLContainerMapping.getReuseContainer.

Return true if the original container on the object should be used if present.
public AbstractNullPolicy
public void
initialize(AbstractSession session)

Overrides org.eclipse.persistence.mappings.DatabaseMapping.initialize.

INTERNAL: Allow for initialization of properties and validation.
public boolean
private boolean
isBinaryType(String className)

private boolean
isBinaryType(Class<?> theClass)

public boolean
isDefaultEmptyContainer()

Implements org.eclipse.persistence.internal.oxm.mappings.XMLContainerMapping.isDefaultEmptyContainer.

INTERNAL Return true if an empty container should be set on the object if there is no presence of the collection in the XML document.
public boolean
public boolean
isWriteOnly()

Overrides org.eclipse.persistence.mappings.DatabaseMapping.isWriteOnly.

Implements org.eclipse.persistence.oxm.mappings.XMLMapping.isWriteOnly.

INTERNAL: Some mappings support no attribute (transformation and multitenant primary key).
public boolean
isXMLMapping()

Overrides org.eclipse.persistence.mappings.DatabaseMapping.isXMLMapping.

INTERNAL: All relational mappings should implement this method to return true.
public void
iterate(DescriptorIterator iterator)

Implements abstract org.eclipse.persistence.mappings.DatabaseMapping.iterate.

INTERNAL: Iterate on the appropriate attribute value.
public void
mergeChangesIntoObject(Object target, ChangeRecord changeRecord, Object source, MergeManager mergeManager, AbstractSession targetSession)

Implements abstract org.eclipse.persistence.mappings.DatabaseMapping.mergeChangesIntoObject.

INTERNAL: Merge changes from the source to the target object.
public void
mergeIntoObject(Object target, boolean isTargetUninitialized, Object source, MergeManager mergeManager, AbstractSession targetSession)

Implements abstract org.eclipse.persistence.mappings.DatabaseMapping.mergeIntoObject.

INTERNAL: Merge changes from the source to the target object.
public void
preInitialize(AbstractSession session)

Overrides org.eclipse.persistence.mappings.DatabaseMapping.preInitialize.

INTERNAL: Allow for initialization of properties and validation.
public void
public void
setChoiceElementMappingsByClass(Map<Class<?>, XMLMapping> choiceElementMappingsByClass)

public void
public void
public void
public void
setDefaultEmptyContainer(boolean defaultEmptyContainer)

Implements org.eclipse.persistence.internal.oxm.mappings.XMLContainerMapping.setDefaultEmptyContainer.

INTERNAL Indicate whether by default an empty container should be set on the field/property if the collection is not present in the XML document.
public void
setIsAny(boolean b)

public void
public void
setMixedContent(String groupingElement)

Implements org.eclipse.persistence.internal.oxm.mappings.ChoiceCollectionMapping.setMixedContent.

PUBLIC: Allows the user to indicate that this mapping should also allow for mixed content in addition to any of the elements in the choice.
public void
setMixedContent(boolean mixed)

Implements org.eclipse.persistence.internal.oxm.mappings.ChoiceCollectionMapping.setMixedContent.

PUBLIC: Allows the user to indicate that this mapping should also allow for mixed content in addition to any of the elements in the choice.
public void
setReuseContainer(boolean reuseContainer)

Implements org.eclipse.persistence.internal.oxm.mappings.XMLContainerMapping.setReuseContainer.

Specify whether the original container on the object should be used if present.
public void
public void
useCollectionClass(Class<?> concreteContainerClass)

public void
public Object
valueFromRow(AbstractRecord row, JoinedAttributeManager joinManager, ObjectBuildingQuery sourceQuery, CacheKey cacheKey, AbstractSession executionSession, boolean isTargetProtected, Boolean[] wasCacheUsed)

Overrides org.eclipse.persistence.mappings.DatabaseMapping.valueFromRow.

INTERNAL: A subclass should implement this method if it wants different behavior.
public void
writeFromObjectIntoRow(Object object, AbstractRecord row, AbstractSession session, DatabaseMapping.WriteType writeType)

Overrides org.eclipse.persistence.mappings.DatabaseMapping.writeFromObjectIntoRow.

INTERNAL: A subclass should implement this method if it wants different behavior.
public void
writeSingleValue(Object
- The value to be marshalled
value
,
Object parent, XMLRecord
- The Record the value is being marshalled too.
row
,
AbstractSession session)

Implements org.eclipse.persistence.internal.oxm.mappings.Mapping.writeSingleValue, org.eclipse.persistence.oxm.mappings.XMLMapping.writeSingleValue.

INTERNAL: A method that marshals a single value to the provided Record based on this mapping's XPath.
Inherited from org.eclipse.persistence.mappings.DatabaseMapping:
addUnconvertedPropertybuildBackupCloneForPartObjectbuildChangeRecordbuildCloneForPartObjectbuildContainerClonebuildCopybuildExpressionbuildObjectJoinExpressionbuildObjectJoinExpressionbuildShallowOriginalFromRowcalculateDeferredChangescascadeDiscoverAndPersistUnregisteredNewObjectscascadePerformRemovePrivateOwnedObjectFromChangeSetIfRequiredclonecloneFieldscollectQueryParametersconvertConverterClassNamesToClassescreateCloneValueHolderderivesIdearlyPreDeleteextractNestedExpressionsextractNestedNonAggregateExpressionsfixRealObjectReferencesgetAttributeAccessorgetAttributeClassificationgetAttributeNamegetAttributeValueFromObjectgetDerivedIdMappinggetDescriptorgetFieldgetFieldClassificationgetGetMethodNamegetMapsIdValuegetObjectCorrespondingTogetOrderByNormalizedExpressionsgetPropertiesgetPropertygetRealAttributeValueFromAttributegetRealAttributeValueFromObjectgetRealCollectionAttributeValueFromObjectgetReferenceDescriptorgetRelationshipPartnergetSelectFieldsgetSelectTablesgetSetMethodNamegetUnconvertedPropertiesgetValueFromRemoteValueHoldergetWeighthasConstraintDependencyhasDependencyhasInverseConstraintDependencyhasMapsIdValuehasNestedIdentityReferencehasRootExpressionThatShouldUseOuterJoinhasUnconvertedPropertiesinstantiateAttributeisAbstractColumnMappingisAbstractCompositeCollectionMappingisAbstractCompositeDirectCollectionMappingisAbstractCompositeObjectMappingisAbstractDirectMappingisAggregateCollectionMappingisAggregateMappingisAggregateObjectMappingisAttributeValueFromObjectInstantiatedisCacheableisCandidateForPrivateOwnedRemovalisCascadedLockingSupportedisChangeTrackingSupportedisCloningRequiredisCollectionMappingisDatabaseMappingisDirectCollectionMappingisDirectMapMappingisDirectToFieldMappingisDirectToXMLTypeMappingisEISMappingisElementCollectionMappingisForeignReferenceMappingisInAndOutSopObjectisInOnlySopObjectisInSopObjectisJoiningSupportedisJPAIdisLazyisLockableMappingisManyToManyMappingisManyToOneMappingisMapKeyMappingisMultitenantPrimaryKeyMappingisNestedTableMappingisObjectReferenceMappingisOneToManyMappingisOneToOneMappingisOptionalisOutOnlySopObjectisOutSopObjectisOwnedisPrimaryKeyMappingisPrivateOwnedisReadOnlyisReferenceMappingisRelationalMappingisRemotelyInitializedisStructureMappingisTransformationMappingisUnidirectionalOneToManyMappingisUsingMethodAccessisVariableOneToOneMappingiterateOnRealAttributeValueloadloadAllperformDataModificationEventpostCalculateChangespostCalculateChangesOnDeletedpostDeletepostInitializepostInitializeSourceAndTargetExpressionspostInsertpostUpdatepreDeletepreInsertprepareCascadeLockingPolicypreUpdatereadFromResultSetIntoObjectreadFromRowIntoObjectreadOnlyreadWriterecordPrivateOwnedRemovalsrehashFieldDependanciesremoteInitializationremotelyInitializedreplaceValueHoldersInsetAttributeAccessorsetAttributeNamesetChangeListenersetDerivedIdMappingsetDerivesIdsetDescriptorsetFieldssetGetMethodNamesetIsCacheablesetIsInAndOutSopObjectsetIsInSopObjectsetIsJPAIdsetIsLazysetIsMapKeyMappingsetIsOptionalsetIsOutSopObjectsetIsPrimaryKeyMappingsetIsReadOnlysetMapsIdValuesetPropertiessetPropertysetRealAttributeValueInObjectsetSetMethodNamesetWeightsimpleAddToCollectionChangeRecordsimpleRemoveFromCollectionChangeRecordtoStringupdateChangeRecordupdateCollectionChangeRecordvalidateAfterInitializationvalidateBeforeInitializationvalueFromObjectvalueFromResultSetvalueFromRowverifyDeletewriteFromAttributeIntoRowwriteFromObjectIntoRowForShallowInsertwriteFromObjectIntoRowForShallowInsertWithChangeRecordwriteFromObjectIntoRowForUpdatewriteFromObjectIntoRowForUpdateAfterShallowInsertwriteFromObjectIntoRowForUpdateBeforeShallowDeletewriteFromObjectIntoRowForWhereClausewriteFromObjectIntoRowWithChangeRecordwriteInsertFieldsIntoRowwriteUpdateFieldsIntoRow