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

public Class XMLFragmentCollectionMapping

extends AbstractCompositeDirectCollectionMapping
implements FragmentCollectionMapping<AbstractSession, AttributeAccessor, ContainerPolicy, ClassDescriptor, DatabaseField, Session, 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.FragmentCollectionMapping, org.eclipse.persistence.internal.oxm.mappings.XMLContainerMapping
Imports
java.util.Enumeration, .Vector, org.eclipse.persistence.descriptors.ClassDescriptor, org.eclipse.persistence.exceptions.DatabaseException, .DescriptorException, org.eclipse.persistence.internal.helper.DatabaseField, org.eclipse.persistence.internal.identitymaps.CacheKey, org.eclipse.persistence.internal.oxm.mappings.FragmentCollectionMapping, .XMLContainerMapping, org.eclipse.persistence.internal.queries.ContainerPolicy, .JoinedAttributeManager, org.eclipse.persistence.internal.sessions.AbstractRecord, .AbstractSession, org.eclipse.persistence.mappings.AttributeAccessor, org.eclipse.persistence.mappings.foundation.AbstractCompositeDirectCollectionMapping, org.eclipse.persistence.oxm.XMLField, org.eclipse.persistence.oxm.mappings.nullpolicy.AbstractNullPolicy, org.eclipse.persistence.oxm.record.DOMRecord, .XMLRecord, org.eclipse.persistence.platform.xml.XMLPlatformFactory, org.eclipse.persistence.queries.ObjectBuildingQuery, org.eclipse.persistence.sessions.Session, org.w3c.dom.Attr, .Element, .Text

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 statements
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");

Field Summary

Modifier and TypeField and Description
private boolean
private boolean
private boolean
private AbstractNullPolicy
Inherited from org.eclipse.persistence.mappings.foundation.AbstractCompositeDirectCollectionMapping:
elementDataTypeNamefieldvalueConverter

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
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 String

Returns:

String the XPath String associated with this Mapping
getXPath
()

Get the XPath String

public void
public boolean
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
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
public void
preInitialize(AbstractSession session)

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

INTERNAL: Allow for initialization of properties and validation.
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
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
setXPath(String
String
xpathString
)

Set the Mapping field name attribute to the given XPath String

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

Overrides org.eclipse.persistence.mappings.foundation.AbstractCompositeDirectCollectionMapping.valueFromRow.

INTERNAL: Build the nested collection from the database row.
public void
public void
writeSingleValue(Object
- The value to be marshalled
attributeValue
,
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.foundation.AbstractCompositeDirectCollectionMapping:
buildAddedElementFromChangeSetbuildBackupClonebuildChangeSetbuildClonebuildCloneFromRowbuildClonePartbuildCopybuildElementFromChangeSetbuildElementFromElementbuildRemovedElementFromChangeSetcascadePerformRemoveIfRequiredcascadeRegisterNewIfRequiredcollectFieldscompareElementscompareElementsForChangecompareForChangecompareObjectsconvertClassNamesToClassesconvertToChangeRecordcreateMapComponentFromRowfixObjectReferencesgetAttributeElementClassgetContainerPolicygetFieldgetFieldClassificationgetFieldElementClassgetFieldNamegetRealCollectionAttributeValueFromObjectgetValueConverterhasValueConverterisCollectionMappingiteratemapKeyHasChangedmergeChangesIntoObjectmergeIntoObjectsetAttributeElementClasssetAttributeElementClassNamesetContainerPolicysetFieldsetFieldElementClasssetUsesSingleNodesetValueConvertersimpleAddToCollectionChangeRecordsimpleRemoveFromCollectionChangeRecorduseCollectionClassuseCollectionClassNameuseListClassNameuseMapClassuseMapClassNameusesSingleNodewriteFromObjectIntoRowForUpdatewriteFromObjectIntoRowWithChangeRecordwriteInsertFieldsIntoRow

Field Detail

defaultEmptyContainerback to summary
private boolean defaultEmptyContainer
isWriteOnlyback to summary
private boolean isWriteOnly
reuseContainerback to summary
private boolean reuseContainer
wrapperNullPolicyback to summary
private AbstractNullPolicy wrapperNullPolicy

Constructor Detail

XMLFragmentCollectionMappingback to summary
public XMLFragmentCollectionMapping()

Method Detail

getReuseContainerback to summary
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. If it is not present then the container policy will be used to create the container.

Annotations
@Override
getWrapperNullPolicyback to summary
public AbstractNullPolicy getWrapperNullPolicy()

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

Doc from org.eclipse.persistence.internal.oxm.mappings.XMLContainerMapping.getWrapperNullPolicy.

Get the Wrapper NullPolicy from the Mapping.

Annotations
@Override
getXPathback to summary
public String getXPath()

Get the XPath String

Returns:String

String the XPath String associated with this Mapping

initializeback to summary
public void initialize(AbstractSession session) throws DescriptorException

Overrides org.eclipse.persistence.mappings.foundation.AbstractCompositeDirectCollectionMapping.initialize.

INTERNAL: Initialize the mapping.

Annotations
@Override
isAbstractCompositeDirectCollectionMappingback to summary
public boolean isAbstractCompositeDirectCollectionMapping()

Overrides org.eclipse.persistence.mappings.foundation.AbstractCompositeDirectCollectionMapping.isAbstractCompositeDirectCollectionMapping.

Implements org.eclipse.persistence.internal.oxm.mappings.Mapping.isAbstractCompositeDirectCollectionMapping.

Doc from org.eclipse.persistence.internal.oxm.mappings.Mapping.isAbstractCompositeDirectCollectionMapping.

Related mapping should implement this method to return true.

Returns:boolean

Doc from org.eclipse.persistence.core.mappings.CoreMapping.isAbstractCompositeDirectCollectionMapping.

TODO

Annotations
@Override
isDefaultEmptyContainerback to summary
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.

Annotations
@Override
Since
EclipseLink 2.3.3
isWriteOnlyback to summary
public boolean isWriteOnly()

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

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

Doc from org.eclipse.persistence.mappings.DatabaseMapping.isWriteOnly.

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

Returns:boolean

Doc from org.eclipse.persistence.core.mappings.CoreMapping.isWriteOnly.

TODO

Annotations
@Override
isXMLMappingback to summary
public boolean isXMLMapping()

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

INTERNAL:

Annotations
@Override
preInitializeback to summary
public void preInitialize(AbstractSession session) throws DescriptorException

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

Doc from org.eclipse.persistence.mappings.DatabaseMapping.preInitialize.

INTERNAL: Allow for initialization of properties and validation.

Annotations
@Override
setAttributeValueInObjectback to summary
public void setAttributeValueInObject(Object object, Object value) throws DescriptorException

Overrides org.eclipse.persistence.mappings.DatabaseMapping.setAttributeValueInObject.

Implements org.eclipse.persistence.internal.oxm.mappings.Mapping.setAttributeValueInObject.

Doc from org.eclipse.persistence.mappings.DatabaseMapping.setAttributeValueInObject.

INTERNAL: Set the value of the attribute mapped by this mapping.

Parameters
object:Object

Doc from org.eclipse.persistence.core.mappings.CoreMapping.setAttributeValueInObject.

TODO

value:Object

Doc from org.eclipse.persistence.core.mappings.CoreMapping.setAttributeValueInObject.

TODO

Annotations
@Override
setDefaultEmptyContainerback to summary
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.

Annotations
@Override
Since
EclipseLink 2.3.3
setIsWriteOnlyback to summary
public void setIsWriteOnly(boolean b)

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

Annotations
@Override
setReuseContainerback to summary
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. If it is not present then the container policy will be used to create the container.

Annotations
@Override
setWrapperNullPolicyback to summary
public void setWrapperNullPolicy(AbstractNullPolicy policy)

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

Doc from org.eclipse.persistence.internal.oxm.mappings.XMLContainerMapping.setWrapperNullPolicy.

Set the Wrapper NullPolicy on the Mapping.

Annotations
@Override
setXPathback to summary
public void setXPath(String xpathString)

Set the Mapping field name attribute to the given XPath String

Parameters
xpathString:String

String

valueFromRowback to summary
public Object valueFromRow(AbstractRecord row, JoinedAttributeManager joinManager, ObjectBuildingQuery sourceQuery, CacheKey cacheKey, AbstractSession executionSession, boolean isTargetProtected, Boolean[] wasCacheUsed) throws DatabaseException

Overrides org.eclipse.persistence.mappings.foundation.AbstractCompositeDirectCollectionMapping.valueFromRow.

INTERNAL: Build the nested collection from the database row.

Annotations
@Override
writeFromObjectIntoRowback to summary
public void writeFromObjectIntoRow(Object object, AbstractRecord row, AbstractSession session, DatabaseMapping.WriteType writeType)

Overrides org.eclipse.persistence.mappings.foundation.AbstractCompositeDirectCollectionMapping.writeFromObjectIntoRow.

INTERNAL:

Annotations
@Override
writeSingleValueback to summary
public void writeSingleValue(Object attributeValue, Object parent, XMLRecord row, AbstractSession session)

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

Doc from 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. Used for Sequenced marshalling.

Parameters
attributeValue:Object

- The value to be marshalled

row:XMLRecord

- The Record the value is being marshalled too.

Annotations
@Override