Class XMLCollectionReferenceMapping
- All Implemented Interfaces:
Serializable,Cloneable,CollectionReferenceMapping<AbstractSession,,AttributeAccessor, ContainerPolicy, ClassDescriptor, DatabaseField, UnmarshalRecord, XMLField, XMLRecord> Mapping<AbstractSession,,AttributeAccessor, ContainerPolicy, ClassDescriptor, DatabaseField, XMLRecord> ObjectReferenceMapping<AbstractSession,,AttributeAccessor, ContainerPolicy, ClassDescriptor, DatabaseField, UnmarshalRecord, XMLField, XMLRecord> XMLContainerMapping,ContainerMapping,XMLMapping
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.persistence.mappings.DatabaseMapping
DatabaseMapping.WriteType -
Field Summary
FieldsFields inherited from class org.eclipse.persistence.oxm.mappings.XMLObjectReferenceMapping
sourceToTargetKeyFieldAssociations, sourceToTargetKeysFields inherited from class org.eclipse.persistence.mappings.AggregateMapping
hasNestedIdentityReference, referenceClass, referenceClassName, referenceDescriptorFields inherited from class org.eclipse.persistence.mappings.DatabaseMapping
attributeAccessor, attributeName, derivedIdMapping, derivesId, descriptor, fields, isCacheable, isInSopObject, isJPAId, isLazy, isMapKeyMapping, isOptional, isPrimaryKeyMapping, isReadOnly, isRemotelyInitialized, mapsIdValue, NO_FIELDS, NO_WEIGHT, properties, unconvertedProperties, weight, WEIGHT_AGGREGATE, WEIGHT_DIRECT, WEIGHT_TO_ONE, WEIGHT_TRANSFORMFields inherited from interface org.eclipse.persistence.internal.oxm.mappings.XMLContainerMapping
EMPTY_CONTAINER_DEFAULT -
Constructor Summary
ConstructorsConstructorDescriptionPUBLIC: The default constructor initializes the sourceToTargetKeyFieldAssociations and sourceToTargetKeys data structures. -
Method Summary
Modifier and TypeMethodDescriptionbuildFieldValue(Object targetObject, XMLField xmlFld, AbstractSession session) INTERNAL: Retrieve the target object's primary key value that is mapped to a given source xpath (in the source-target key field association list).voidbuildReference(Object srcObject, XMLField xmlField, Object object, AbstractSession session, Object container, ReferenceResolver resolver) INTERNAL: Create (if necessary) and populate a reference object that will be used during the mapping reference resolution phase after unmarshalling is complete.voidbuildReference(UnmarshalRecord record, XMLField xmlField, Object object, AbstractSession session, Object container) INTERNAL: Create (if necessary) and populate a reference object that will be used during the mapping reference resolution phase after unmarshalling is complete.INTERNAL: Return the mapping's containerPolicy.getField()INTERNAL: Return the field associated with this mapping if there is exactly one.booleanReturn true if the original container on the object should be used if present.Get the Wrapper NullPolicy from the Mapping.getXPath()Get the XPath Stringvoidinitialize(AbstractSession session) INTERNAL: The mapping is initialized with the given session.booleanINTERNAL: Related mapping should implement this method to return true.booleanINTERNAL Return true if an empty container should be set on the object if there is no presence of the collection in the XML document.readFromRowIntoObject(AbstractRecord databaseRow, JoinedAttributeManager joinManager, Object targetObject, CacheKey parentCacheKey, ObjectBuildingQuery sourceQuery, AbstractSession executionSession, boolean isTargetProtected) INTERNAL: Extract the primary key values from the row, then create an org.eclipse.persistence.internal.oxm.Reference instance and stored it on the session's org.eclipse.persistence.internal.oxm.ReferenceResolver.readFromRowIntoObject(AbstractRecord databaseRow, JoinedAttributeManager joinManager, Object targetObject, CacheKey parentCacheKey, ObjectBuildingQuery sourceQuery, AbstractSession executionSession, boolean isTargetProtected, Object container) INTERNAL: Extract the primary key values from the row, then create an org.eclipse.persistence.internal.oxm.Reference instance and stored it on the session's org.eclipse.persistence.internal.oxm.ReferenceResolver.voidsetContainerPolicy(ContainerPolicy containerPolicy) ADVANCED: Set the mapping's containerPolicy.voidsetDefaultEmptyContainer(boolean defaultEmptyContainer) 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.voidsetField(DatabaseField field) voidsetReuseContainer(boolean reuseContainer) Specify whether the original container on the object should be used if present.voidsetUsesSingleNode(boolean useSingleNode) voidSet the Wrapper NullPolicy on the Mapping.voidSet the Mapping field name attribute to the given XPath StringvoiduseCollectionClass(Class<?> concreteContainerClass) PUBLIC: Configure the mapping to use an instance of the specified container class to hold the target objects.voiduseCollectionClassName(String concreteContainerClassName) PUBLIC: Configure the mapping to use an instance of the specified container class to hold the target objects.voiduseListClassName(String concreteContainerClassName) PUBLIC: Configure the mapping to use an instance of the specified container class to hold the target objects.voiduseMapClass(Class<?> concreteContainerClass, String methodName) PUBLIC: Configure the mapping to use an instance of the specified container class to hold the target objects.voiduseMapClassName(String concreteContainerClass, String methodName) PUBLIC: Configure the mapping to use an instance of the specified container class to hold the target objects.booleanINTERNAL: For the purpose of XMLCollectionReferenceMappings, 'usesSingleNode' refers to the fact that the source key xpath fields should all be written as space-separated lists.voidwriteFromObjectIntoRow(Object object, AbstractRecord row, AbstractSession session, DatabaseMapping.WriteType writeType) INTERNAL: Write the attribute value from the object to the row.voidwriteSingleValue(Object value, Object parent, XMLRecord row, AbstractSession session) INTERNAL: A method that marshals a single value to the provided Record based on this mapping's XPath.Methods inherited from class org.eclipse.persistence.oxm.mappings.XMLObjectReferenceMapping
addSourceToTargetKeyFieldAssociation, addSourceToTargetKeyFieldAssociation, buildReference, cascadePerformRemoveIfRequired, cascadeRegisterNewIfRequired, getFields, getInverseReferenceMapping, getSchemaType, getSingleValueToWriteForUnion, getSourceToTargetKeyFieldAssociations, getValueToWrite, isObjectReferenceMapping, isWriteOnly, isXMLMapping, preInitialize, setAttributeValueInObject, setIsWriteOnly, setSourceToTargetKeyFieldAssociationsMethods inherited from class org.eclipse.persistence.mappings.AggregateMapping
buildAggregateDeleteQuery, buildAggregateModifyQuery, buildAggregateWriteQuery, buildBackupClone, buildBackupClonePart, buildClone, buildCloneFromRow, buildClonePart, buildClonePart, buildCopy, buildCopyOfAttributeValue, buildExpression, buildNewMergeInstanceOf, compareAttributeValues, compareForChange, compareObjects, convertClassNamesToClasses, executeEvent, fixAttributeValue, fixObjectReferences, getAttributeValueFromBackupClone, getObjectBuilder, getObjectBuilderForClass, getQueryManager, getReferenceClass, getReferenceClassName, getReferenceDescriptor, getReferenceDescriptor, getReferenceDescriptor, hasNestedIdentityReference, isAggregateMapping, iterate, iterateOnAttributeValue, load, loadAll, mergeAttributeValue, mergeChangesIntoObject, mergeIntoObject, postDelete, postDeleteAttributeValue, postInsert, postInsertAttributeValue, postUpdate, postUpdateAttributeValue, preDelete, preDeleteAttributeValue, preInsert, preInsertAttributeValue, preUpdate, preUpdateAttributeValue, remoteInitialization, setReferenceClass, setReferenceClassName, setReferenceDescriptor, updateChangeRecord, verifyDelete, verifyDeleteOfAttributeValueMethods inherited from class org.eclipse.persistence.mappings.DatabaseMapping
addUnconvertedProperty, buildBackupCloneForPartObject, buildChangeRecord, buildCloneForPartObject, buildContainerClone, buildObjectJoinExpression, buildObjectJoinExpression, buildShallowOriginalFromRow, calculateDeferredChanges, cascadeDiscoverAndPersistUnregisteredNewObjects, cascadePerformRemovePrivateOwnedObjectFromChangeSetIfRequired, clone, cloneFields, collectFields, collectQueryParameters, convertConverterClassNamesToClasses, createCloneValueHolder, derivesId, earlyPreDelete, extractNestedExpressions, extractNestedNonAggregateExpressions, fixRealObjectReferences, getAttributeAccessor, getAttributeClassification, getAttributeName, getAttributeValueFromObject, getDerivedIdMapping, getDescriptor, getFieldClassification, getGetMethodName, getMapsIdValue, getObjectCorrespondingTo, getOrderByNormalizedExpressions, getProperties, getProperty, getRealAttributeValueFromAttribute, getRealAttributeValueFromObject, getRealCollectionAttributeValueFromObject, getRelationshipPartner, getSelectFields, getSelectTables, getSetMethodName, getUnconvertedProperties, getValueFromRemoteValueHolder, getWeight, hasConstraintDependency, hasDependency, hasInverseConstraintDependency, hasMapsIdValue, hasRootExpressionThatShouldUseOuterJoin, hasUnconvertedProperties, instantiateAttribute, isAbstractColumnMapping, isAbstractCompositeCollectionMapping, isAbstractCompositeDirectCollectionMapping, isAbstractCompositeObjectMapping, isAbstractDirectMapping, isAggregateCollectionMapping, isAggregateObjectMapping, isAttributeValueFromObjectInstantiated, isCacheable, isCandidateForPrivateOwnedRemoval, isCascadedLockingSupported, isChangeTrackingSupported, isCloningRequired, isDatabaseMapping, isDirectCollectionMapping, isDirectMapMapping, isDirectToFieldMapping, isDirectToXMLTypeMapping, isEISMapping, isElementCollectionMapping, isForeignReferenceMapping, isInAndOutSopObject, isInOnlySopObject, isInSopObject, isJoiningSupported, isJPAId, isLazy, isLockableMapping, isManyToManyMapping, isManyToOneMapping, isMapKeyMapping, isMultitenantPrimaryKeyMapping, isNestedTableMapping, isOneToManyMapping, isOneToOneMapping, isOptional, isOutOnlySopObject, isOutSopObject, isOwned, isPrimaryKeyMapping, isPrivateOwned, isReadOnly, isReferenceMapping, isRelationalMapping, isRemotelyInitialized, isStructureMapping, isTransformationMapping, isUnidirectionalOneToManyMapping, isUsingMethodAccess, isVariableOneToOneMapping, iterateOnRealAttributeValue, performDataModificationEvent, postCalculateChanges, postCalculateChangesOnDeleted, postInitialize, postInitializeSourceAndTargetExpressions, prepareCascadeLockingPolicy, readFromResultSetIntoObject, readOnly, readWrite, recordPrivateOwnedRemovals, rehashFieldDependancies, remotelyInitialized, replaceValueHoldersIn, setAttributeAccessor, setAttributeName, setChangeListener, setDerivedIdMapping, setDerivesId, setDescriptor, setFields, setGetMethodName, setIsCacheable, setIsInAndOutSopObject, setIsInSopObject, setIsJPAId, setIsLazy, setIsMapKeyMapping, setIsOptional, setIsOutSopObject, setIsPrimaryKeyMapping, setIsReadOnly, setMapsIdValue, setProperties, setProperty, setRealAttributeValueInObject, setSetMethodName, setWeight, simpleAddToCollectionChangeRecord, simpleRemoveFromCollectionChangeRecord, toString, updateCollectionChangeRecord, validateAfterInitialization, validateBeforeInitialization, valueFromObject, valueFromResultSet, valueFromRow, valueFromRow, writeFromAttributeIntoRow, writeFromObjectIntoRowForShallowInsert, writeFromObjectIntoRowForShallowInsertWithChangeRecord, writeFromObjectIntoRowForUpdate, writeFromObjectIntoRowForUpdateAfterShallowInsert, writeFromObjectIntoRowForUpdateBeforeShallowDelete, writeFromObjectIntoRowForWhereClause, writeFromObjectIntoRowWithChangeRecord, writeInsertFieldsIntoRow, writeUpdateFieldsIntoRowMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.persistence.internal.oxm.mappings.Mapping
getAttributeAccessor, getAttributeClassification, getAttributeName, getAttributeValueFromObject, getDescriptor, getReferenceDescriptor, isAbstractCompositeCollectionMapping, isAbstractCompositeDirectCollectionMapping, isAbstractCompositeObjectMapping, isAbstractDirectMapping, isReadOnly, isReferenceMapping, isTransformationMapping, setAttributeAccessor, setAttributeName, setAttributeValueInObject, setGetMethodName, setIsReadOnly, setProperties, setSetMethodNameMethods inherited from interface org.eclipse.persistence.internal.oxm.mappings.ObjectReferenceMapping
addSourceToTargetKeyFieldAssociation, buildReference, getFields, getInverseReferenceMapping, getReferenceClass, getReferenceClassName, getSourceToTargetKeyFieldAssociations, isWriteOnly, setIsWriteOnly, setReferenceClassNameMethods inherited from interface org.eclipse.persistence.oxm.mappings.XMLMapping
convertClassNamesToClasses
-
Field Details
-
containerPolicy
-
-
Constructor Details
-
XMLCollectionReferenceMapping
public XMLCollectionReferenceMapping()PUBLIC: The default constructor initializes the sourceToTargetKeyFieldAssociations and sourceToTargetKeys data structures.
-
-
Method Details
-
getField
Description copied from class:DatabaseMappingINTERNAL: Return the field associated with this mapping if there is exactly one. This is required for object relational mapping to print them, but because they are defined in in an Enterprise context they cannot be cast to. Mappings that have a field include direct mappings and object relational mappings.- Specified by:
getFieldin interfaceMapping<AbstractSession,AttributeAccessor, ContainerPolicy, ClassDescriptor, DatabaseField, XMLRecord> - Overrides:
getFieldin classDatabaseMapping- Returns:
- TODO
-
setField
- Overrides:
setFieldin classXMLObjectReferenceMapping
-
getXPath
Get the XPath String- Returns:
- String the XPath String associated with this Mapping
-
setXPath
Set the Mapping field name attribute to the given XPath String- Parameters:
xpathString- String
-
buildFieldValue
INTERNAL: Retrieve the target object's primary key value that is mapped to a given source xpath (in the source-target key field association list).- Specified by:
buildFieldValuein interfaceObjectReferenceMapping<AbstractSession,AttributeAccessor, ContainerPolicy, ClassDescriptor, DatabaseField, UnmarshalRecord, XMLField, XMLRecord> - Overrides:
buildFieldValuein classXMLObjectReferenceMapping- Parameters:
targetObject- - the reference class instance that holds the required pk value- Returns:
- null if the target object is null, the reference class is null, or a primary key field name does not exist on the reference descriptor that matches the target field name - otherwise, return the associated primary key value
-
buildReference
public void buildReference(UnmarshalRecord record, XMLField xmlField, Object object, AbstractSession session, Object container) INTERNAL: Create (if necessary) and populate a reference object that will be used during the mapping reference resolution phase after unmarshalling is complete.- Specified by:
buildReferencein interfaceCollectionReferenceMapping<AbstractSession,AttributeAccessor, ContainerPolicy, ClassDescriptor, DatabaseField, UnmarshalRecord, XMLField, XMLRecord>
-
buildReference
public void buildReference(Object srcObject, XMLField xmlField, Object object, AbstractSession session, Object container, ReferenceResolver resolver) INTERNAL: Create (if necessary) and populate a reference object that will be used during the mapping reference resolution phase after unmarshalling is complete. -
getContainerPolicy
INTERNAL: Return the mapping's containerPolicy.- Specified by:
getContainerPolicyin interfaceContainerMapping- Specified by:
getContainerPolicyin interfaceMapping<AbstractSession,AttributeAccessor, ContainerPolicy, ClassDescriptor, DatabaseField, XMLRecord> - Overrides:
getContainerPolicyin classDatabaseMapping- Returns:
- TODO
-
initialize
INTERNAL: The mapping is initialized with the given session. This mapping is fully initialized after this.- Overrides:
initializein classXMLObjectReferenceMapping- Throws:
DescriptorException- See Also:
-
readFromRowIntoObject
public Object readFromRowIntoObject(AbstractRecord databaseRow, JoinedAttributeManager joinManager, Object targetObject, CacheKey parentCacheKey, ObjectBuildingQuery sourceQuery, AbstractSession executionSession, boolean isTargetProtected) throws DatabaseException INTERNAL: Extract the primary key values from the row, then create an org.eclipse.persistence.internal.oxm.Reference instance and stored it on the session's org.eclipse.persistence.internal.oxm.ReferenceResolver.- Overrides:
readFromRowIntoObjectin classXMLObjectReferenceMapping- Throws:
DatabaseException
-
readFromRowIntoObject
public Object readFromRowIntoObject(AbstractRecord databaseRow, JoinedAttributeManager joinManager, Object targetObject, CacheKey parentCacheKey, ObjectBuildingQuery sourceQuery, AbstractSession executionSession, boolean isTargetProtected, Object container) throws DatabaseException INTERNAL: Extract the primary key values from the row, then create an org.eclipse.persistence.internal.oxm.Reference instance and stored it on the session's org.eclipse.persistence.internal.oxm.ReferenceResolver.- Throws:
DatabaseException
-
setContainerPolicy
ADVANCED: Set the mapping's containerPolicy.- Specified by:
setContainerPolicyin interfaceContainerMapping
-
useCollectionClass
PUBLIC: Configure the mapping to use an instance of the specified container class to hold the target objects.jdk1.2.x: The container class must implement (directly or indirectly) the Collection interface.
jdk1.1.x: The container class must be a subclass of Vector.
- Specified by:
useCollectionClassin interfaceContainerMapping
-
useCollectionClassName
Description copied from interface:ContainerMappingPUBLIC: Configure the mapping to use an instance of the specified container class to hold the target objects.The container class must implement (directly or indirectly) the
java.util.Collectioninterface.- Specified by:
useCollectionClassNamein interfaceCollectionReferenceMapping<AbstractSession,AttributeAccessor, ContainerPolicy, ClassDescriptor, DatabaseField, UnmarshalRecord, XMLField, XMLRecord> - Specified by:
useCollectionClassNamein interfaceContainerMapping
-
useListClassName
Description copied from interface:ContainerMappingPUBLIC: Configure the mapping to use an instance of the specified container class to hold the target objects.The container class must implement (directly or indirectly) the
java.util.Listinterface.- Specified by:
useListClassNamein interfaceContainerMapping
-
useMapClass
PUBLIC: Configure the mapping to use an instance of the specified container class to hold the target objects. The key used to index the value in the Map is the value returned by a call to the specified zero-argument method. The method must be implemented by the class (or a superclass) of the value to be inserted into the Map.jdk1.2.x: The container class must implement (directly or indirectly) the Map interface.
jdk1.1.x: The container class must be a subclass of Hashtable.
The referenceClass must be set before calling this method.
- Specified by:
useMapClassin interfaceContainerMapping
-
useMapClassName
PUBLIC: Configure the mapping to use an instance of the specified container class to hold the target objects. The key used to index the value in the Map is the value returned by a call to the specified zero-argument method. The method must be implemented by the class (or a superclass) of the value to be inserted into the Map.jdk1.2.x: The container class must implement (directly or indirectly) the Map interface.
jdk1.1.x: The container class must be a subclass of Hashtable.
The referenceClass must be set before calling this method.
- Specified by:
useMapClassNamein interfaceContainerMapping
-
usesSingleNode
public boolean usesSingleNode()INTERNAL: For the purpose of XMLCollectionReferenceMappings, 'usesSingleNode' refers to the fact that the source key xpath fields should all be written as space-separated lists. Would be used for mapping to an IDREFS field in a schema- Specified by:
usesSingleNodein interfaceCollectionReferenceMapping<AbstractSession,AttributeAccessor, ContainerPolicy, ClassDescriptor, DatabaseField, UnmarshalRecord, XMLField, XMLRecord>
-
setUsesSingleNode
public void setUsesSingleNode(boolean useSingleNode) -
writeFromObjectIntoRow
public void writeFromObjectIntoRow(Object object, AbstractRecord row, AbstractSession session, DatabaseMapping.WriteType writeType) INTERNAL: Write the attribute value from the object to the row.- Overrides:
writeFromObjectIntoRowin classXMLObjectReferenceMapping
-
writeSingleValue
Description copied from interface:XMLMappingINTERNAL: A method that marshals a single value to the provided Record based on this mapping's XPath. Used for Sequenced marshalling.- Specified by:
writeSingleValuein interfaceMapping<AbstractSession,AttributeAccessor, ContainerPolicy, ClassDescriptor, DatabaseField, XMLRecord> - Specified by:
writeSingleValuein interfaceXMLMapping- Overrides:
writeSingleValuein classXMLObjectReferenceMapping- Parameters:
value- - The value to be marshalledrow- - The Record the value is being marshalled too.
-
isCollectionMapping
public boolean isCollectionMapping()Description copied from class:DatabaseMappingINTERNAL: Related mapping should implement this method to return true.- Specified by:
isCollectionMappingin interfaceMapping<AbstractSession,AttributeAccessor, ContainerPolicy, ClassDescriptor, DatabaseField, XMLRecord> - Overrides:
isCollectionMappingin classDatabaseMapping- Returns:
- TODO
-
getReuseContainer
public boolean getReuseContainer()Return true if the original container on the object should be used if present. If it is not present then the container policy will be used to create the container.- Specified by:
getReuseContainerin interfaceXMLContainerMapping
-
setReuseContainer
public void setReuseContainer(boolean reuseContainer) Specify whether the original container on the object should be used if present. If it is not present then the container policy will be used to create the container.- Specified by:
setReuseContainerin interfaceXMLContainerMapping
-
isDefaultEmptyContainer
public boolean 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.- Specified by:
isDefaultEmptyContainerin interfaceXMLContainerMapping- Since:
- EclipseLink 2.3.3
-
setDefaultEmptyContainer
public void setDefaultEmptyContainer(boolean defaultEmptyContainer) 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.- Specified by:
setDefaultEmptyContainerin interfaceXMLContainerMapping- Since:
- EclipseLink 2.3.3
-
getWrapperNullPolicy
Description copied from interface:XMLContainerMappingGet the Wrapper NullPolicy from the Mapping.- Specified by:
getWrapperNullPolicyin interfaceXMLContainerMapping
-
setWrapperNullPolicy
Description copied from interface:XMLContainerMappingSet the Wrapper NullPolicy on the Mapping.- Specified by:
setWrapperNullPolicyin interfaceXMLContainerMapping
-