EclipseLink 2.4.2, build 'v20130514-5956486' API Reference

org.eclipse.persistence.oxm.mappings
Class XMLFragmentCollectionMapping

java.lang.Object
  extended by org.eclipse.persistence.mappings.DatabaseMapping
      extended by org.eclipse.persistence.mappings.foundation.AbstractCompositeDirectCollectionMapping
          extended by org.eclipse.persistence.oxm.mappings.XMLFragmentCollectionMapping
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, org.eclipse.persistence.internal.oxm.XMLContainerMapping, ContainerMapping, ArrayCollectionMapping, XMLMapping

public class XMLFragmentCollectionMapping
extends AbstractCompositeDirectCollectionMapping
implements XMLMapping, org.eclipse.persistence.internal.oxm.XMLContainerMapping

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:
Serialized Form

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, valueConverter
 
Fields inherited from class org.eclipse.persistence.mappings.DatabaseMapping
attributeAccessor, attributeName, derivedIdMapping, derivesId, descriptor, fields, isCacheable, isJPAId, isLazy, isMapKeyMapping, isOptional, isPrimaryKeyMapping, isReadOnly, isRemotelyInitialized, mapsIdValue, NO_FIELDS, NO_WEIGHT, properties, unconvertedProperties, weight, WEIGHT_AGGREGATE, WEIGHT_DIRECT, WEIGHT_TO_ONE, WEIGHT_TRANSFORM
 
Fields inherited from interface org.eclipse.persistence.internal.oxm.XMLContainerMapping
EMPTY_CONTAINER_DEFAULT
 
Constructor Summary
XMLFragmentCollectionMapping()
           
 
Method Summary
 boolean getReuseContainer()
          Return true if the original container on the object should be used if present.
 AbstractNullPolicy getWrapperNullPolicy()
           
 java.lang.String getXPath()
          Get the XPath String
 void initialize(org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Initialize the mapping.
 boolean isAbstractCompositeDirectCollectionMapping()
          INTERNAL:
 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.
 boolean isWriteOnly()
          INTERNAL: Some mappings support no attribute (transformation and multitenant primary key).
 boolean isXMLMapping()
          INTERNAL:
 void preInitialize(org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Allow for initialization of properties and validation.
 void setAttributeValueInObject(java.lang.Object object, java.lang.Object value)
          INTERNAL: Set the value of the attribute mapped by this mapping.
 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.
 void setIsWriteOnly(boolean b)
           
 void setReuseContainer(boolean reuseContainer)
          Specify whether the original container on the object should be used if present.
 void setWrapperNullPolicy(AbstractNullPolicy policy)
           
 void setXPath(java.lang.String xpathString)
          Set the Mapping field name attribute to the given XPath String
 java.lang.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, java.lang.Boolean[] wasCacheUsed)
          INTERNAL: Build the nested collection from the database row.
 void writeFromObjectIntoRow(java.lang.Object object, org.eclipse.persistence.internal.sessions.AbstractRecord row, org.eclipse.persistence.internal.sessions.AbstractSession session, DatabaseMapping.WriteType writeType)
          INTERNAL:
 void writeSingleValue(java.lang.Object attributeValue, java.lang.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, writeInsertFieldsIntoRow
 
Methods inherited from class org.eclipse.persistence.mappings.DatabaseMapping
addUnconvertedProperty, buildBackupCloneForPartObject, buildChangeRecord, buildCloneForPartObject, buildContainerClone, buildExpression, buildObjectJoinExpression, buildObjectJoinExpression, buildShallowOriginalFromRow, calculateDeferredChanges, cascadeDiscoverAndPersistUnregisteredNewObjects, cascadePerformRemovePrivateOwnedObjectFromChangeSetIfRequired, clone, cloneFields, collectQueryParameters, createCloneValueHolder, derivesId, earlyPreDelete, extractNestedExpressions, 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, hasRootExpressionThatShouldUseOuterJoin, hasUnconvertedProperties, instantiateAttribute, isAbstractColumnMapping, isAbstractCompositeCollectionMapping, isAbstractCompositeObjectMapping, isAbstractDirectMapping, isAggregateCollectionMapping, isAggregateMapping, isAggregateObjectMapping, isCacheable, isCandidateForPrivateOwnedRemoval, isCascadedLockingSupported, isChangeTrackingSupported, isCloningRequired, isDatabaseMapping, isDirectCollectionMapping, isDirectMapMapping, isDirectToFieldMapping, isDirectToXMLTypeMapping, isEISMapping, isElementCollectionMapping, isForeignReferenceMapping, isJoiningSupported, isJPAId, isLazy, isLockableMapping, isManyToManyMapping, isManyToOneMapping, isMapKeyMapping, isMultitenantPrimaryKeyMapping, isNestedTableMapping, isObjectReferenceMapping, isOneToManyMapping, isOneToOneMapping, isOptional, isOwned, isPrimaryKeyMapping, isPrivateOwned, isReadOnly, isReferenceMapping, isRelationalMapping, isRemotelyInitialized, isStructureMapping, isTransformationMapping, isUnidirectionalOneToManyMapping, isUsingMethodAccess, isVariableOneToOneMapping, iterateOnRealAttributeValue, performDataModificationEvent, postCalculateChanges, postCalculateChangesOnDeleted, postDelete, postInitialize, postInsert, postUpdate, preDelete, preInsert, prepareCascadeLockingPolicy, preUpdate, readFromResultSetIntoObject, readFromRowIntoObject, readOnly, readWrite, recordPrivateOwnedRemovals, rehashFieldDependancies, remoteInitialization, remotelyInitialized, replaceValueHoldersIn, setAttributeAccessor, setAttributeName, setChangeListener, setDerivedIdMapping, setDerivesId, setDescriptor, setFields, setGetMethodName, setIsCacheable, setIsJPAId, setIsLazy, setIsMapKeyMapping, setIsOptional, setIsPrimaryKeyMapping, setIsReadOnly, setMapsIdValue, setProperties, setProperty, setRealAttributeValueInObject, setSetMethodName, setWeight, toString, updateChangeRecord, updateCollectionChangeRecord, validateAfterInitialization, validateBeforeInitialization, valueFromObject, valueFromResultSet, valueFromRow, verifyDelete, writeFromAttributeIntoRow, writeFromObjectIntoRowForShallowInsert, writeFromObjectIntoRowForShallowInsertWithChangeRecord, writeFromObjectIntoRowForUpdateAfterShallowInsert, writeFromObjectIntoRowForUpdateBeforeShallowDelete, writeFromObjectIntoRowForWhereClause, writeUpdateFieldsIntoRow
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.persistence.oxm.mappings.XMLMapping
convertClassNamesToClasses
 
Methods inherited from interface org.eclipse.persistence.mappings.structures.ArrayCollectionMapping
getAttributeName, setRealAttributeValueInObject
 

Constructor Detail

XMLFragmentCollectionMapping

public XMLFragmentCollectionMapping()
Method Detail

isXMLMapping

public boolean isXMLMapping()
INTERNAL:

Overrides:
isXMLMapping in class DatabaseMapping

initialize

public void initialize(org.eclipse.persistence.internal.sessions.AbstractSession session)
                throws DescriptorException
INTERNAL: Initialize the mapping.

Overrides:
initialize in class AbstractCompositeDirectCollectionMapping
Throws:
DescriptorException

setXPath

public void setXPath(java.lang.String xpathString)
Set the Mapping field name attribute to the given XPath String

Parameters:
xpathString - String

getXPath

public java.lang.String getXPath()
Get the XPath String

Returns:
String the XPath String associated with this Mapping

valueFromRow

public java.lang.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,
                                     java.lang.Boolean[] wasCacheUsed)
                              throws DatabaseException
INTERNAL: Build the nested collection from the database row.

Overrides:
valueFromRow in class AbstractCompositeDirectCollectionMapping
Throws:
DatabaseException

writeFromObjectIntoRow

public void writeFromObjectIntoRow(java.lang.Object object,
                                   org.eclipse.persistence.internal.sessions.AbstractRecord row,
                                   org.eclipse.persistence.internal.sessions.AbstractSession session,
                                   DatabaseMapping.WriteType writeType)
INTERNAL:

Overrides:
writeFromObjectIntoRow in class AbstractCompositeDirectCollectionMapping

isAbstractCompositeDirectCollectionMapping

public boolean isAbstractCompositeDirectCollectionMapping()
Description copied from class: AbstractCompositeDirectCollectionMapping
INTERNAL:

Overrides:
isAbstractCompositeDirectCollectionMapping in class AbstractCompositeDirectCollectionMapping

writeSingleValue

public void writeSingleValue(java.lang.Object attributeValue,
                             java.lang.Object parent,
                             XMLRecord row,
                             org.eclipse.persistence.internal.sessions.AbstractSession session)
Description copied from interface: XMLMapping
INTERNAL: A method that marshals a single value to the provided Record based on this mapping's XPath. Used for Sequenced marshalling.

Specified by:
writeSingleValue in interface XMLMapping
Parameters:
attributeValue - - The value to be marshalled
row - - The Record the value is being marshalled too.

isWriteOnly

public boolean isWriteOnly()
Description copied from class: DatabaseMapping
INTERNAL: Some mappings support no attribute (transformation and multitenant primary key).

Specified by:
isWriteOnly in interface XMLMapping
Overrides:
isWriteOnly in class DatabaseMapping

setIsWriteOnly

public void setIsWriteOnly(boolean b)
Specified by:
setIsWriteOnly in interface XMLMapping

preInitialize

public void preInitialize(org.eclipse.persistence.internal.sessions.AbstractSession session)
                   throws DescriptorException
Description copied from class: DatabaseMapping
INTERNAL: Allow for initialization of properties and validation.

Overrides:
preInitialize in class DatabaseMapping
Throws:
DescriptorException

setAttributeValueInObject

public void setAttributeValueInObject(java.lang.Object object,
                                      java.lang.Object value)
                               throws DescriptorException
Description copied from class: DatabaseMapping
INTERNAL: Set the value of the attribute mapped by this mapping.

Overrides:
setAttributeValueInObject in class DatabaseMapping
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:
getReuseContainer in interface org.eclipse.persistence.internal.oxm.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:
setReuseContainer in interface org.eclipse.persistence.internal.oxm.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:
isDefaultEmptyContainer in interface org.eclipse.persistence.internal.oxm.XMLContainerMapping
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:
setDefaultEmptyContainer in interface org.eclipse.persistence.internal.oxm.XMLContainerMapping
Since:
EclipseLink 2.3.3

getWrapperNullPolicy

public AbstractNullPolicy getWrapperNullPolicy()
Specified by:
getWrapperNullPolicy in interface org.eclipse.persistence.internal.oxm.XMLContainerMapping

setWrapperNullPolicy

public void setWrapperNullPolicy(AbstractNullPolicy policy)
Specified by:
setWrapperNullPolicy in interface org.eclipse.persistence.internal.oxm.XMLContainerMapping

EclipseLink 2.4.2, build 'v20130514-5956486' API Reference