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

public Class XMLFragmentMapping

extends XMLDirectMapping
implements FragmentMapping<AbstractSession, AttributeAccessor, ContainerPolicy, ClassDescriptor, DatabaseField, Session, XMLRecord>
Class Inheritance
All Implemented Interfaces
org.eclipse.persistence.internal.oxm.mappings.FragmentMapping, org.eclipse.persistence.internal.oxm.mappings.Mapping
Imports
org.eclipse.persistence.descriptors.ClassDescriptor, org.eclipse.persistence.internal.helper.DatabaseField, org.eclipse.persistence.internal.identitymaps.CacheKey, org.eclipse.persistence.internal.oxm.mappings.FragmentMapping, org.eclipse.persistence.internal.queries.ContainerPolicy, .JoinedAttributeManager, org.eclipse.persistence.internal.sessions.AbstractRecord, .AbstractSession, org.eclipse.persistence.mappings.AttributeAccessor, org.eclipse.persistence.oxm.XMLField, 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.Element, .Text

Purpose: This mapping provides a means to keep a part of the xml tree as a DOM element.

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("phoneNumber");
mapping.setXPath("contact-info/phone-number");

Field Summary

Inherited from org.eclipse.persistence.oxm.mappings.XMLDirectMapping:
isCDATAnullPolicy

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean
public boolean
public void
setXPath(String
String
xpathString
)

Overrides org.eclipse.persistence.oxm.mappings.XMLDirectMapping.setXPath.

Implements org.eclipse.persistence.internal.oxm.mappings.DirectMapping.setXPath.

Set the Mapping field name attribute to the given XPath String
public Object
valueFromRow(AbstractRecord row, JoinedAttributeManager joinManager, ObjectBuildingQuery query, CacheKey cacheKey, AbstractSession executionSession, boolean isTargetProtected, Boolean[] wasCacheUsed)

Overrides org.eclipse.persistence.oxm.mappings.XMLDirectMapping.valueFromRow.

INTERNAL: Return the mapping's attribute value from the row.
public void
writeFromObjectIntoRow(Object object, AbstractRecord row, AbstractSession session, DatabaseMapping.WriteType writeType)

Overrides org.eclipse.persistence.oxm.mappings.XMLDirectMapping.writeFromObjectIntoRow.

INTERNAL: Get a value from the object and set that in the respective field of the row.
public void
writeSingleValue(Object
- The value to be marshalled
attributeValue
,
Object parent, XMLRecord
- The Record the value is being marshalled too.
row
,
AbstractSession session)

Overrides org.eclipse.persistence.oxm.mappings.XMLDirectMapping.writeSingleValue.

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.oxm.mappings.XMLDirectMapping:
convertDataValueToObjectValueconvertObjectValueToDataValuegetAttributeValuegetFieldValuegetNullPolicygetXPathinitializeisCDATAisCloningRequiredisCollapsingStringValuesisNormalizingStringValuesisNullValueMarshalledisWriteOnlyisXMLMappingpreInitializesetAttributeValueInObjectsetCollapsingStringValuessetIsCDATAsetIsWriteOnlysetNormalizingStringValuessetNullPolicysetNullValueMarshalledwriteValueIntoRow

Constructor Detail

XMLFragmentMappingback to summary
public XMLFragmentMapping()

Method Detail

isAbstractColumnMappingback to summary
public boolean isAbstractColumnMapping()

Overrides org.eclipse.persistence.mappings.foundation.AbstractColumnMapping.isAbstractColumnMapping.

Doc from org.eclipse.persistence.mappings.foundation.AbstractColumnMapping.isAbstractColumnMapping.

INTERNAL:

Annotations
@Override
isAbstractDirectMappingback to summary
public boolean isAbstractDirectMapping()

Overrides org.eclipse.persistence.mappings.foundation.AbstractDirectMapping.isAbstractDirectMapping.

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

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

Related mapping should implement this method to return true.

Returns:boolean

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

TODO

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

Overrides org.eclipse.persistence.oxm.mappings.XMLDirectMapping.setXPath.

Implements org.eclipse.persistence.internal.oxm.mappings.DirectMapping.setXPath.

Doc from org.eclipse.persistence.oxm.mappings.XMLDirectMapping.setXPath.

Set the Mapping field name attribute to the given XPath String

Parameters
xpathString:String

String

Annotations
@Override
valueFromRowback to summary
public Object valueFromRow(AbstractRecord row, JoinedAttributeManager joinManager, ObjectBuildingQuery query, CacheKey cacheKey, AbstractSession executionSession, boolean isTargetProtected, Boolean[] wasCacheUsed)

Overrides org.eclipse.persistence.oxm.mappings.XMLDirectMapping.valueFromRow.

Doc from org.eclipse.persistence.oxm.mappings.XMLDirectMapping.valueFromRow.

INTERNAL: Return the mapping's attribute value from the row. The execution session is passed for the case of building a UnitOfWork clone directly from a row, the session set in the query will not know which platform to use for converting the value. Allows the correct session to be passed in.

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

Overrides org.eclipse.persistence.oxm.mappings.XMLDirectMapping.writeFromObjectIntoRow.

INTERNAL: Get a value from the object and set that in the respective field of the row.

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

Overrides org.eclipse.persistence.oxm.mappings.XMLDirectMapping.writeSingleValue.

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