Class XMLFragmentCollectionMapping
java.lang.Object
org.eclipse.persistence.core.mappings.CoreMapping<AttributeAccessor,org.eclipse.persistence.internal.sessions.AbstractSession,org.eclipse.persistence.internal.queries.ContainerPolicy,ClassDescriptor,org.eclipse.persistence.internal.helper.DatabaseField>
org.eclipse.persistence.mappings.DatabaseMapping
org.eclipse.persistence.mappings.foundation.AbstractCompositeDirectCollectionMapping
org.eclipse.persistence.oxm.mappings.XMLFragmentCollectionMapping
- All Implemented Interfaces:
Serializable,Cloneable,org.eclipse.persistence.internal.oxm.mappings.FragmentCollectionMapping<org.eclipse.persistence.internal.sessions.AbstractSession,,AttributeAccessor, org.eclipse.persistence.internal.queries.ContainerPolicy, ClassDescriptor, org.eclipse.persistence.internal.helper.DatabaseField, Session, XMLRecord> org.eclipse.persistence.internal.oxm.mappings.Mapping<org.eclipse.persistence.internal.sessions.AbstractSession,,AttributeAccessor, org.eclipse.persistence.internal.queries.ContainerPolicy, ClassDescriptor, org.eclipse.persistence.internal.helper.DatabaseField, XMLRecord> org.eclipse.persistence.internal.oxm.mappings.XMLContainerMapping,ContainerMapping,ArrayCollectionMapping,XMLMapping
public class XMLFragmentCollectionMapping
extends AbstractCompositeDirectCollectionMapping
implements org.eclipse.persistence.internal.oxm.mappings.FragmentCollectionMapping<org.eclipse.persistence.internal.sessions.AbstractSession,AttributeAccessor,org.eclipse.persistence.internal.queries.ContainerPolicy,ClassDescriptor,org.eclipse.persistence.internal.helper.DatabaseField,Session,XMLRecord>, XMLMapping
Purpose: This mapping provides a means to keep a part of the xml tree as a collection of DOM elements.
Setting the XPath: TopLink XML mappings make use of XPath statements to find the relevant
data in an XML document. The XPath statement is relative to the context node specified in the descriptor.
The XPath may contain path and positional information; the last node in the XPath forms the local
root node for the fragment. The XPath is specified on the mapping using the setXPath
method.
| XPath | Description |
|---|---|
| phone-number | The phone-number information is stored in the phone-number element. |
| contact-info/phone-number | The XPath statement may be used to specify any valid path. |
Sample Configuration:
XMLFragmentCollectionMapping mapping = new XMLFragmentCollectionMapping();
mapping.setAttributeName("phoneNumbers");
mapping.setXPath("contact-info/phone-number");
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.persistence.mappings.DatabaseMapping
DatabaseMapping.WriteType -
Field Summary
Fields inherited from class org.eclipse.persistence.mappings.foundation.AbstractCompositeDirectCollectionMapping
elementDataTypeName, field, valueConverterFields 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturn 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(org.eclipse.persistence.internal.sessions.AbstractSession session) INTERNAL: Initialize the mapping.booleanINTERNAL: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.booleanINTERNAL: Some mappings support no attribute (transformation and multitenant primary key).booleanINTERNAL:voidpreInitialize(org.eclipse.persistence.internal.sessions.AbstractSession session) INTERNAL: Allow for initialization of properties and validation.voidsetAttributeValueInObject(Object object, Object value) INTERNAL: Set the value of the attribute mapped by this mapping.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.voidsetIsWriteOnly(boolean b) voidsetReuseContainer(boolean reuseContainer) Specify whether the original container on the object should be used if present.voidSet the Wrapper NullPolicy on the Mapping.voidSet the Mapping field name attribute to the given XPath StringvalueFromRow(org.eclipse.persistence.internal.sessions.AbstractRecord row, org.eclipse.persistence.internal.queries.JoinedAttributeManager joinManager, ObjectBuildingQuery sourceQuery, org.eclipse.persistence.internal.identitymaps.CacheKey cacheKey, org.eclipse.persistence.internal.sessions.AbstractSession executionSession, boolean isTargetProtected, Boolean[] wasCacheUsed) INTERNAL: Build the nested collection from the database row.voidwriteFromObjectIntoRow(Object object, org.eclipse.persistence.internal.sessions.AbstractRecord row, org.eclipse.persistence.internal.sessions.AbstractSession session, DatabaseMapping.WriteType writeType) INTERNAL:voidwriteSingleValue(Object attributeValue, Object parent, XMLRecord row, org.eclipse.persistence.internal.sessions.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.mappings.foundation.AbstractCompositeDirectCollectionMapping
buildAddedElementFromChangeSet, buildBackupClone, buildChangeSet, buildClone, buildCloneFromRow, buildClonePart, buildCopy, buildElementFromChangeSet, buildElementFromElement, buildRemovedElementFromChangeSet, cascadePerformRemoveIfRequired, cascadeRegisterNewIfRequired, collectFields, compareElements, compareElementsForChange, compareForChange, compareObjects, convertClassNamesToClasses, convertToChangeRecord, createMapComponentFromRow, fixObjectReferences, getAttributeElementClass, getContainerPolicy, getField, getFieldClassification, getFieldElementClass, getFieldName, getRealCollectionAttributeValueFromObject, getValueConverter, hasValueConverter, isCollectionMapping, iterate, mapKeyHasChanged, mergeChangesIntoObject, mergeIntoObject, setAttributeElementClass, setAttributeElementClassName, setContainerPolicy, setField, setFieldElementClass, setUsesSingleNode, setValueConverter, simpleAddToCollectionChangeRecord, simpleRemoveFromCollectionChangeRecord, useCollectionClass, useCollectionClassName, useListClassName, useMapClass, useMapClassName, usesSingleNode, writeFromObjectIntoRowForUpdate, writeFromObjectIntoRowWithChangeRecord, writeInsertFieldsIntoRowMethods inherited from class org.eclipse.persistence.mappings.DatabaseMapping
addUnconvertedProperty, buildBackupCloneForPartObject, buildChangeRecord, buildCloneForPartObject, buildContainerClone, buildExpression, buildObjectJoinExpression, buildObjectJoinExpression, buildShallowOriginalFromRow, calculateDeferredChanges, cascadeDiscoverAndPersistUnregisteredNewObjects, cascadePerformRemovePrivateOwnedObjectFromChangeSetIfRequired, clone, cloneFields, collectQueryParameters, convertConverterClassNamesToClasses, createCloneValueHolder, derivesId, earlyPreDelete, extractNestedExpressions, extractNestedNonAggregateExpressions, fixRealObjectReferences, getAttributeAccessor, getAttributeClassification, getAttributeName, getAttributeValueFromObject, getDerivedIdMapping, getDescriptor, getFields, getGetMethodName, getMapsIdValue, getObjectCorrespondingTo, getOrderByNormalizedExpressions, getProperties, getProperty, getRealAttributeValueFromAttribute, getRealAttributeValueFromObject, getReferenceDescriptor, getRelationshipPartner, getSelectFields, getSelectTables, getSetMethodName, getUnconvertedProperties, getValueFromRemoteValueHolder, getWeight, hasConstraintDependency, hasDependency, hasInverseConstraintDependency, hasMapsIdValue, hasNestedIdentityReference, hasRootExpressionThatShouldUseOuterJoin, hasUnconvertedProperties, instantiateAttribute, isAbstractColumnMapping, isAbstractCompositeCollectionMapping, isAbstractCompositeObjectMapping, isAbstractDirectMapping, isAggregateCollectionMapping, isAggregateMapping, 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, isObjectReferenceMapping, isOneToManyMapping, isOneToOneMapping, isOptional, isOutOnlySopObject, isOutSopObject, isOwned, isPrimaryKeyMapping, isPrivateOwned, isReadOnly, isReferenceMapping, isRelationalMapping, isRemotelyInitialized, isStructureMapping, isTransformationMapping, isUnidirectionalOneToManyMapping, isUsingMethodAccess, isVariableOneToOneMapping, iterateOnRealAttributeValue, load, loadAll, performDataModificationEvent, postCalculateChanges, postCalculateChangesOnDeleted, postDelete, postInitialize, postInitializeSourceAndTargetExpressions, postInsert, postUpdate, preDelete, preInsert, prepareCascadeLockingPolicy, preUpdate, readFromResultSetIntoObject, readFromRowIntoObject, readOnly, readWrite, recordPrivateOwnedRemovals, rehashFieldDependancies, remoteInitialization, 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, toString, updateChangeRecord, updateCollectionChangeRecord, validateAfterInitialization, validateBeforeInitialization, valueFromObject, valueFromResultSet, valueFromRow, verifyDelete, writeFromAttributeIntoRow, writeFromObjectIntoRowForShallowInsert, writeFromObjectIntoRowForShallowInsertWithChangeRecord, writeFromObjectIntoRowForUpdateAfterShallowInsert, writeFromObjectIntoRowForUpdateBeforeShallowDelete, writeFromObjectIntoRowForWhereClause, writeUpdateFieldsIntoRowMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.persistence.mappings.structures.ArrayCollectionMapping
getAttributeName, setRealAttributeValueInObjectMethods inherited from interface org.eclipse.persistence.internal.oxm.mappings.Mapping
getAttributeAccessor, getAttributeClassification, getAttributeName, getAttributeValueFromObject, getContainerPolicy, getDescriptor, getField, getReferenceDescriptor, isAbstractCompositeCollectionMapping, isAbstractCompositeObjectMapping, isAbstractDirectMapping, isCollectionMapping, isReadOnly, isReferenceMapping, isTransformationMapping, setAttributeAccessor, setAttributeName, setGetMethodName, setIsReadOnly, setProperties, setSetMethodNameMethods inherited from interface org.eclipse.persistence.oxm.mappings.XMLMapping
convertClassNamesToClasses
-
Constructor Details
-
XMLFragmentCollectionMapping
public XMLFragmentCollectionMapping()
-
-
Method Details
-
isXMLMapping
public boolean isXMLMapping()INTERNAL:- Overrides:
isXMLMappingin classDatabaseMapping
-
initialize
public void initialize(org.eclipse.persistence.internal.sessions.AbstractSession session) throws DescriptorException INTERNAL: Initialize the mapping.- Overrides:
initializein classAbstractCompositeDirectCollectionMapping- Throws:
DescriptorException
-
setXPath
Set the Mapping field name attribute to the given XPath String- Parameters:
xpathString- String
-
getXPath
Get the XPath String- Returns:
- String the XPath String associated with this Mapping
-
valueFromRow
public Object valueFromRow(org.eclipse.persistence.internal.sessions.AbstractRecord row, org.eclipse.persistence.internal.queries.JoinedAttributeManager joinManager, ObjectBuildingQuery sourceQuery, org.eclipse.persistence.internal.identitymaps.CacheKey cacheKey, org.eclipse.persistence.internal.sessions.AbstractSession executionSession, boolean isTargetProtected, Boolean[] wasCacheUsed) throws DatabaseException INTERNAL: Build the nested collection from the database row.- Overrides:
valueFromRowin classAbstractCompositeDirectCollectionMapping- Throws:
DatabaseException
-
writeFromObjectIntoRow
public void writeFromObjectIntoRow(Object object, org.eclipse.persistence.internal.sessions.AbstractRecord row, org.eclipse.persistence.internal.sessions.AbstractSession session, DatabaseMapping.WriteType writeType) INTERNAL:- Overrides:
writeFromObjectIntoRowin classAbstractCompositeDirectCollectionMapping
-
isAbstractCompositeDirectCollectionMapping
public boolean isAbstractCompositeDirectCollectionMapping()Description copied from class:AbstractCompositeDirectCollectionMappingINTERNAL:- Specified by:
isAbstractCompositeDirectCollectionMappingin interfaceorg.eclipse.persistence.internal.oxm.mappings.Mapping<org.eclipse.persistence.internal.sessions.AbstractSession,AttributeAccessor, org.eclipse.persistence.internal.queries.ContainerPolicy, ClassDescriptor, org.eclipse.persistence.internal.helper.DatabaseField, XMLRecord> - Overrides:
isAbstractCompositeDirectCollectionMappingin classAbstractCompositeDirectCollectionMapping
-
writeSingleValue
public void writeSingleValue(Object attributeValue, Object parent, XMLRecord row, org.eclipse.persistence.internal.sessions.AbstractSession session) 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 interfaceorg.eclipse.persistence.internal.oxm.mappings.Mapping<org.eclipse.persistence.internal.sessions.AbstractSession,AttributeAccessor, org.eclipse.persistence.internal.queries.ContainerPolicy, ClassDescriptor, org.eclipse.persistence.internal.helper.DatabaseField, XMLRecord> - Specified by:
writeSingleValuein interfaceXMLMapping- Parameters:
attributeValue- - The value to be marshalledrow- - The Record the value is being marshalled too.
-
isWriteOnly
public boolean isWriteOnly()Description copied from class:DatabaseMappingINTERNAL: Some mappings support no attribute (transformation and multitenant primary key).- Specified by:
isWriteOnlyin interfaceXMLMapping- Overrides:
isWriteOnlyin classDatabaseMapping
-
setIsWriteOnly
public void setIsWriteOnly(boolean b) - Specified by:
setIsWriteOnlyin interfaceXMLMapping
-
preInitialize
public void preInitialize(org.eclipse.persistence.internal.sessions.AbstractSession session) throws DescriptorException Description copied from class:DatabaseMappingINTERNAL: Allow for initialization of properties and validation.- Overrides:
preInitializein classDatabaseMapping- Throws:
DescriptorException
-
setAttributeValueInObject
Description copied from class:DatabaseMappingINTERNAL: Set the value of the attribute mapped by this mapping.- Specified by:
setAttributeValueInObjectin interfaceorg.eclipse.persistence.internal.oxm.mappings.Mapping<org.eclipse.persistence.internal.sessions.AbstractSession,AttributeAccessor, org.eclipse.persistence.internal.queries.ContainerPolicy, ClassDescriptor, org.eclipse.persistence.internal.helper.DatabaseField, XMLRecord> - Overrides:
setAttributeValueInObjectin classDatabaseMapping- Throws:
DescriptorException
-
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 interfaceorg.eclipse.persistence.internal.oxm.mappings.XMLContainerMapping
-
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 interfaceorg.eclipse.persistence.internal.oxm.mappings.XMLContainerMapping
-
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 interfaceorg.eclipse.persistence.internal.oxm.mappings.XMLContainerMapping
-
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 interfaceorg.eclipse.persistence.internal.oxm.mappings.XMLContainerMapping
-
getWrapperNullPolicy
Description copied from interface:org.eclipse.persistence.internal.oxm.mappings.XMLContainerMappingGet the Wrapper NullPolicy from the Mapping.- Specified by:
getWrapperNullPolicyin interfaceorg.eclipse.persistence.internal.oxm.mappings.XMLContainerMapping
-
setWrapperNullPolicy
Description copied from interface:org.eclipse.persistence.internal.oxm.mappings.XMLContainerMappingSet the Wrapper NullPolicy on the Mapping.- Specified by:
setWrapperNullPolicyin interfaceorg.eclipse.persistence.internal.oxm.mappings.XMLContainerMapping
-