Class XMLDirectMapping
- 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.AbstractColumnMapping
-
- org.eclipse.persistence.mappings.foundation.AbstractDirectMapping
-
- org.eclipse.persistence.oxm.mappings.XMLDirectMapping
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,org.eclipse.persistence.internal.oxm.mappings.DirectMapping<org.eclipse.persistence.internal.sessions.AbstractSession,AttributeAccessor,org.eclipse.persistence.internal.queries.ContainerPolicy,Converter,ClassDescriptor,org.eclipse.persistence.internal.helper.DatabaseField,XMLMarshaller,Session,XMLUnmarshaller,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.XMLConverterMapping<XMLMarshaller,Session,XMLUnmarshaller>,MapComponentMapping,MapKeyMapping,XMLMapping,XMLNillableMapping
- Direct Known Subclasses:
XMLBinaryDataMapping,XMLFragmentMapping
public class XMLDirectMapping extends AbstractDirectMapping implements XMLMapping, org.eclipse.persistence.internal.oxm.mappings.DirectMapping<org.eclipse.persistence.internal.sessions.AbstractSession,AttributeAccessor,org.eclipse.persistence.internal.queries.ContainerPolicy,Converter,ClassDescriptor,org.eclipse.persistence.internal.helper.DatabaseField,XMLMarshaller,Session,XMLUnmarshaller,XMLRecord>, XMLNillableMapping
XML Direct Mappings map a Java attribute directly to XML attribute or text node.
XML Direct Mappings can be used in the following scenarios:
- Mapping to a Text Node
- Mapping to an Attribute
- Mapping to a Specified Schema Type
- Mapping to a List Field
- Mapping to a Union Field
- Mapping to a Union of Lists
- Mapping to a Union of Unions
- Mapping with a Simple Type Translator
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 node type, path, and positional information. The XPath is specified on the mapping using the
setXPathmethod.The following XPath statements may be used to specify the location of XML data relating to an object's name attribute:
XPath Description @name The "@" character indicates that the node is an attribute. text() "text()" indicates that the node is a text node. In this case the name value in the text node belongs to the context node. full-name/text() The name information is stored in the text node of the full-name element. personal-info/name/text() The XPath statement may be used to specify any valid path. name[2]/text() The XPath statement may contain positional information. In this case the name information is stored in the text node of the second occurrence of the name element. Mapping to a Specific Schema Type: In most cases TopLink can determine the target format in the XML document. However, there are cases where you must specify which one of a number of possible targets TopLink should use. For example, a java.util.Calendar could be marshalled to a schema date, time, or dateTime, or a byte[] could be marshalled to a schema hexBinary or base64Binary node.
XML Schema
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="customer" type="customer-type"/>
<xsd:complexType name="customer-type">
<xsd:sequence>
<xsd:element name="picture" type="xsd:hexBinary"/>
<xsd:element name="resume" type="xsd:base64Binary"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
Code Sample
XMLDirectMapping pictureMapping = new XMLDirectMapping();
pictureMapping.setAttributeName("picture");
pictureMapping.setXPath("picture/text()");
XMLField pictureField = (XMLField) pictureMapping.getField();
pictureField.setSchemaType(XMLConstants.HEX_BINARY_QNAME);
Mapping to a Union Field:
XML Schema
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="customer" type="customer-type"/>
<xsd:complexType name="customer-type">
<xsd:sequence>
<xsd:element name="shoe-size" type="size-type"/>
</xsd:sequence>
</xsd:complexType>
<xsd:simpleType name="size-type">
<xsd:union memberTypes="xsd:decimal xsd:string"/>
</xsd:simpleType>
</xsd:schema>
Code Sample
XMLDirectMapping shoeSizeMapping = new XMLDirectMapping();
shoeSizeMapping.setAttributeName("shoeSize");
XMLUnionField shoeSizeField = new XMLUnionField();
shoeSizeField.setXPath("shoe-size/text()");
shoeSizeField.addSchemaType(XMLConstants.DECIMAL_QNAME);
shoeSizeField.addSchemaType(XMLConstants.STRING_QNAME);
shoeSizeMapping.setField(shoeSizeField);
Preserving the Node Type: If the type of a node is not defined in your XML schema, you can configure an XML Direct Mapping to use the xsi:type attribute to provide type information.
Code Sample
XMLDirectMapping numberMapping = new XMLDirectMapping();
numberMapping.setAttributeName("number");
numberMapping.setXPath("number/text()");
XMLField numberField = (XMLField) numberMapping.getField();
numberField.setIsTypedTextField(true);
More Information: For more information about using the XML Direct Mapping, see the "Understanding XML Mappings" chapter of the Oracle TopLink Developer's Guide.
- See Also:
- Serialized Form
- Since:
- Oracle TopLink 10g Release 2 (10.1.3)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.eclipse.persistence.mappings.DatabaseMapping
DatabaseMapping.WriteType
-
-
Field Summary
Fields Modifier and Type Field Description booleanisCDATA-
Fields inherited from class org.eclipse.persistence.mappings.foundation.AbstractDirectMapping
attributeClassification, attributeClassificationName, attributeObjectClassification, bypassDefaultNullValueCheck, fieldClassificationClassName, isMutable, keyTableForMapKey, nullValue
-
Fields inherited from class org.eclipse.persistence.mappings.foundation.AbstractColumnMapping
converter, converterClassName, field, isInsertable, isUpdatable
-
Fields 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_TRANSFORM
-
-
Constructor Summary
Constructors Constructor Description XMLDirectMapping()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.ObjectconvertDataValueToObjectValue(java.lang.Object fieldValue, Session session, XMLUnmarshaller unmarshaller)INTERNALjava.lang.ObjectconvertObjectValueToDataValue(java.lang.Object value, Session session, XMLMarshaller marshaller)INTERNALjava.lang.ObjectgetAttributeValue(java.lang.Object fieldValue, org.eclipse.persistence.internal.sessions.AbstractSession session, org.eclipse.persistence.internal.oxm.record.AbstractUnmarshalRecord record)INTERNAL: Allows for subclasses to convert the attribute value.java.lang.ObjectgetFieldValue(java.lang.Object attributeValue, org.eclipse.persistence.internal.core.sessions.CoreAbstractSession session, org.eclipse.persistence.internal.oxm.record.AbstractMarshalRecord record)INTERNAL: Convert the attribute value to a field value.AbstractNullPolicygetNullPolicy()INTERNAL: Get the AbstractNullPolicy from the Mapping.
The default policy is NullPolicy.java.lang.StringgetXPath()Get the XPath Stringvoidinitialize(org.eclipse.persistence.internal.sessions.AbstractSession session)INTERNAL: The mapping is initialized with the given session.booleanisCDATA()booleanisCloningRequired()INTERNAL: Return if this mapping requires its attribute value to be cloned.booleanisCollapsingStringValues()PUBLIC: Returns true if this mapping should collapse all string values before setting them in the object on unmarshal.booleanisNormalizingStringValues()PUBLIC: Returns true if this mapping is normalizing string values on unmarshal before setting them in the object.booleanisNullValueMarshalled()PUBLIC: Returns true if this mapping's value should be marshalled, in the case that it is equal to the default null value.booleanisWriteOnly()INTERNAL: Some mappings support no attribute (transformation and multitenant primary key).booleanisXMLMapping()INTERNAL:voidpreInitialize(org.eclipse.persistence.internal.sessions.AbstractSession session)INTERNAL: Initialize the attribute classification.voidsetAttributeValueInObject(java.lang.Object object, java.lang.Object value)INTERNAL: Set the value of the attribute mapped by this mapping.voidsetCollapsingStringValues(boolean collapse)PUBLIC: Indicates that this mapping should collapse all string values before setting them in the object on unmarshal.voidsetIsCDATA(boolean CDATA)voidsetIsWriteOnly(boolean b)voidsetNormalizingStringValues(boolean normalize)PUBLIC: Indicates that this mapping should normalize all string values before setting them in the object on unmarshal.voidsetNullPolicy(AbstractNullPolicy aNullPolicy)Set the AbstractNullPolicy on the mapping
The default policy is NullPolicy.voidsetNullValueMarshalled(boolean value)PUBLIC: Set whether this mapping's value should be marshalled, in the case that it is equal to the default null value.voidsetXPath(java.lang.String xpathString)Set the Mapping field name attribute to the given XPath Stringjava.lang.ObjectvalueFromRow(org.eclipse.persistence.internal.sessions.AbstractRecord row, org.eclipse.persistence.internal.queries.JoinedAttributeManager joinManager, ObjectBuildingQuery query, org.eclipse.persistence.internal.identitymaps.CacheKey cacheKey, org.eclipse.persistence.internal.sessions.AbstractSession executionSession, boolean isTargetProtected, java.lang.Boolean[] wasCacheUsed)INTERNAL: Return the mapping's attribute value from the row.voidwriteFromObjectIntoRow(java.lang.Object object, org.eclipse.persistence.internal.sessions.AbstractRecord row, org.eclipse.persistence.internal.sessions.AbstractSession session, DatabaseMapping.WriteType writeType)INTERNAL: Get a value from the object and set that in the respective field of the row.voidwriteSingleValue(java.lang.Object value, 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.protected voidwriteValueIntoRow(org.eclipse.persistence.internal.sessions.AbstractRecord row, org.eclipse.persistence.internal.helper.DatabaseField aField, java.lang.Object fieldValue)INTERNAL:-
Methods inherited from class org.eclipse.persistence.mappings.foundation.AbstractDirectMapping
addAdditionalFieldsToQuery, addFieldsForMapKey, addKeyToDeletedObjectsList, buildBackupClone, buildChangeRecord, buildClone, buildCloneFromRow, buildCloneValue, buildCloneValue, buildCopy, buildElementClone, buildExpression, buildSelectionQueryForDirectCollectionKeyMapping, buildShallowOriginalFromRow, cascadeDiscoverAndPersistUnregisteredNewObjects, cascadePerformRemoveIfRequired, cascadePerformRemoveIfRequired, cascadeRegisterNewIfRequired, cascadeRegisterNewIfRequired, compareForChange, compareObjects, compareObjectValues, convertClassNamesToClasses, createMapComponentFromJoinedRow, createMapComponentFromRow, createMapComponentsFromSerializableKeyInfo, createQueryKeyForMapKey, createSerializableMapKeyInfo, createStubbedMapComponentFromSerializableKeyInfo, deleteMapKey, extractIdentityFieldsForQuery, getAdditionalSelectionCriteriaForMapKey, getAdditionalTablesForJoinQuery, getAllFieldsForMapKey, getAttributeClassification, getAttributeClassificationName, getFieldClassification, getFieldClassification, getFieldClassificationClassName, getFieldName, getFieldValue, getForeignKeyFieldsForMapKey, getIdentityFieldsForMapKey, getMapKeyTargetType, getNestedJoinQuery, getNullValue, getObjectValue, getObjectValueWithoutClassCheck, getReferenceDescriptor, getTargetVersionOfSourceObject, getWeight, internalBuildChangeRecord, isAbstractDirectMapping, isChangeTrackingSupported, isDirectToFieldMapping, isMutable, iterateOnMapKey, mergeChangesIntoObject, mergeIntoObject, postInitializeMapKey, preinitializeMapKey, remoteInitialization, requiresDataModificationEventsForMapKey, setAttributeClassification, setAttributeClassificationName, setFieldClassification, setFieldClassificationClassName, setFieldType, setIsMutable, setNullValue, toString, unwrapKey, updateChangeRecord, validateBeforeInitialization, valueFromObject, valueFromResultSet, wrapKey, writeFromObjectIntoRowForUpdate, writeFromObjectIntoRowWithChangeRecord, writeInsertFieldsIntoRow, writeUpdateFieldsIntoRow
-
Methods inherited from class org.eclipse.persistence.mappings.foundation.AbstractColumnMapping
clone, collectFields, fixObjectReferences, getConverter, getField, hasConverter, isAbstractColumnMapping, isInsertable, isUpdatable, iterate, setConverter, setConverterClassName, setField
-
Methods inherited from class org.eclipse.persistence.mappings.DatabaseMapping
addUnconvertedProperty, buildBackupCloneForPartObject, buildCloneForPartObject, buildContainerClone, buildObjectJoinExpression, buildObjectJoinExpression, calculateDeferredChanges, cascadeDiscoverAndPersistUnregisteredNewObjects, cascadePerformRemovePrivateOwnedObjectFromChangeSetIfRequired, cloneFields, collectQueryParameters, convertConverterClassNamesToClasses, createCloneValueHolder, derivesId, earlyPreDelete, extractNestedExpressions, extractNestedNonAggregateExpressions, fixRealObjectReferences, getAttributeAccessor, getAttributeName, getAttributeValueFromObject, getContainerPolicy, getDerivedIdMapping, getDescriptor, getFields, getGetMethodName, getMapsIdValue, getObjectCorrespondingTo, getOrderByNormalizedExpressions, getProperties, getProperty, getRealAttributeValueFromAttribute, getRealAttributeValueFromObject, getRealCollectionAttributeValueFromObject, getRelationshipPartner, getSelectFields, getSelectTables, getSetMethodName, getUnconvertedProperties, getValueFromRemoteValueHolder, hasConstraintDependency, hasDependency, hasInverseConstraintDependency, hasMapsIdValue, hasNestedIdentityReference, hasRootExpressionThatShouldUseOuterJoin, hasUnconvertedProperties, instantiateAttribute, isAbstractCompositeCollectionMapping, isAbstractCompositeDirectCollectionMapping, isAbstractCompositeObjectMapping, isAggregateCollectionMapping, isAggregateMapping, isAggregateObjectMapping, isAttributeValueFromObjectInstantiated, isCacheable, isCandidateForPrivateOwnedRemoval, isCascadedLockingSupported, isCollectionMapping, isDatabaseMapping, isDirectCollectionMapping, isDirectMapMapping, 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, 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, updateCollectionChangeRecord, validateAfterInitialization, valueFromRow, verifyDelete, writeFromAttributeIntoRow, writeFromObjectIntoRowForShallowInsert, writeFromObjectIntoRowForShallowInsertWithChangeRecord, writeFromObjectIntoRowForUpdateAfterShallowInsert, writeFromObjectIntoRowForUpdateBeforeShallowDelete, writeFromObjectIntoRowForWhereClause
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.eclipse.persistence.internal.oxm.mappings.DirectMapping
getConverter, getNullValue, getObjectValue, hasConverter, setAttributeClassification, setAttributeClassificationName, setConverter, setField, setNullValue, valueFromObject
-
Methods inherited from interface org.eclipse.persistence.mappings.foundation.MapComponentMapping
clone
-
Methods inherited from interface org.eclipse.persistence.internal.oxm.mappings.Mapping
getAttributeAccessor, getAttributeClassification, getAttributeName, getAttributeValueFromObject, getContainerPolicy, getDescriptor, getField, getReferenceDescriptor, isAbstractCompositeCollectionMapping, isAbstractCompositeDirectCollectionMapping, isAbstractCompositeObjectMapping, isAbstractDirectMapping, isCollectionMapping, isReadOnly, isReferenceMapping, isTransformationMapping, setAttributeAccessor, setAttributeName, setGetMethodName, setIsReadOnly, setProperties, setSetMethodName
-
Methods inherited from interface org.eclipse.persistence.oxm.mappings.XMLMapping
convertClassNamesToClasses
-
-
-
-
Method Detail
-
setNullPolicy
public void setNullPolicy(AbstractNullPolicy aNullPolicy)
Set the AbstractNullPolicy on the mapping
The default policy is NullPolicy.- Specified by:
setNullPolicyin interfaceorg.eclipse.persistence.internal.oxm.mappings.DirectMapping<org.eclipse.persistence.internal.sessions.AbstractSession,AttributeAccessor,org.eclipse.persistence.internal.queries.ContainerPolicy,Converter,ClassDescriptor,org.eclipse.persistence.internal.helper.DatabaseField,XMLMarshaller,Session,XMLUnmarshaller,XMLRecord>- Specified by:
setNullPolicyin interfaceXMLNillableMapping- Parameters:
aNullPolicy-
-
getNullPolicy
public AbstractNullPolicy getNullPolicy()
INTERNAL: Get the AbstractNullPolicy from the Mapping.
The default policy is NullPolicy.- Specified by:
getNullPolicyin interfaceorg.eclipse.persistence.internal.oxm.mappings.DirectMapping<org.eclipse.persistence.internal.sessions.AbstractSession,AttributeAccessor,org.eclipse.persistence.internal.queries.ContainerPolicy,Converter,ClassDescriptor,org.eclipse.persistence.internal.helper.DatabaseField,XMLMarshaller,Session,XMLUnmarshaller,XMLRecord>- Specified by:
getNullPolicyin interfaceXMLNillableMapping- Returns:
-
isXMLMapping
public boolean isXMLMapping()
INTERNAL:- Overrides:
isXMLMappingin classDatabaseMapping
-
setXPath
public void setXPath(java.lang.String xpathString)
Set the Mapping field name attribute to the given XPath String- Specified by:
setXPathin interfaceorg.eclipse.persistence.internal.oxm.mappings.DirectMapping<org.eclipse.persistence.internal.sessions.AbstractSession,AttributeAccessor,org.eclipse.persistence.internal.queries.ContainerPolicy,Converter,ClassDescriptor,org.eclipse.persistence.internal.helper.DatabaseField,XMLMarshaller,Session,XMLUnmarshaller,XMLRecord>- Parameters:
xpathString- String
-
initialize
public void initialize(org.eclipse.persistence.internal.sessions.AbstractSession session) throws DescriptorExceptionDescription copied from class:AbstractDirectMappingINTERNAL: The mapping is initialized with the given session. This mapping is fully initialized after this.- Overrides:
initializein classAbstractDirectMapping- Throws:
DescriptorException
-
getAttributeValue
public java.lang.Object getAttributeValue(java.lang.Object fieldValue, org.eclipse.persistence.internal.sessions.AbstractSession session, org.eclipse.persistence.internal.oxm.record.AbstractUnmarshalRecord record)INTERNAL: Allows for subclasses to convert the attribute value.- Specified by:
getAttributeValuein interfaceorg.eclipse.persistence.internal.oxm.mappings.DirectMapping<org.eclipse.persistence.internal.sessions.AbstractSession,AttributeAccessor,org.eclipse.persistence.internal.queries.ContainerPolicy,Converter,ClassDescriptor,org.eclipse.persistence.internal.helper.DatabaseField,XMLMarshaller,Session,XMLUnmarshaller,XMLRecord>
-
getFieldValue
public java.lang.Object getFieldValue(java.lang.Object attributeValue, org.eclipse.persistence.internal.core.sessions.CoreAbstractSession session, org.eclipse.persistence.internal.oxm.record.AbstractMarshalRecord record)INTERNAL: Convert the attribute value to a field value. Process any converter if defined, and check for null values.- Specified by:
getFieldValuein interfaceorg.eclipse.persistence.internal.oxm.mappings.DirectMapping<org.eclipse.persistence.internal.sessions.AbstractSession,AttributeAccessor,org.eclipse.persistence.internal.queries.ContainerPolicy,Converter,ClassDescriptor,org.eclipse.persistence.internal.helper.DatabaseField,XMLMarshaller,Session,XMLUnmarshaller,XMLRecord>
-
getXPath
public java.lang.String getXPath()
Get the XPath String- Specified by:
getXPathin interfaceorg.eclipse.persistence.internal.oxm.mappings.DirectMapping<org.eclipse.persistence.internal.sessions.AbstractSession,AttributeAccessor,org.eclipse.persistence.internal.queries.ContainerPolicy,Converter,ClassDescriptor,org.eclipse.persistence.internal.helper.DatabaseField,XMLMarshaller,Session,XMLUnmarshaller,XMLRecord>- 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 query, org.eclipse.persistence.internal.identitymaps.CacheKey cacheKey, org.eclipse.persistence.internal.sessions.AbstractSession executionSession, boolean isTargetProtected, java.lang.Boolean[] wasCacheUsed)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.- Overrides:
valueFromRowin classAbstractDirectMapping
-
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: Get a value from the object and set that in the respective field of the row.- Overrides:
writeFromObjectIntoRowin classAbstractDirectMapping
-
writeValueIntoRow
protected void writeValueIntoRow(org.eclipse.persistence.internal.sessions.AbstractRecord row, org.eclipse.persistence.internal.helper.DatabaseField aField, java.lang.Object fieldValue)Description copied from class:AbstractColumnMappingINTERNAL:- Specified by:
writeValueIntoRowin classAbstractDirectMapping
-
writeSingleValue
public void writeSingleValue(java.lang.Object value, java.lang.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:
value- - The value to be marshalledrow- - The Record the value is being marshalled too.
-
setAttributeValueInObject
public void setAttributeValueInObject(java.lang.Object object, java.lang.Object value) throws DescriptorExceptionDescription 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
-
setIsCDATA
public void setIsCDATA(boolean CDATA)
- Specified by:
setIsCDATAin interfaceorg.eclipse.persistence.internal.oxm.mappings.DirectMapping<org.eclipse.persistence.internal.sessions.AbstractSession,AttributeAccessor,org.eclipse.persistence.internal.queries.ContainerPolicy,Converter,ClassDescriptor,org.eclipse.persistence.internal.helper.DatabaseField,XMLMarshaller,Session,XMLUnmarshaller,XMLRecord>
-
isCDATA
public boolean isCDATA()
- Specified by:
isCDATAin interfaceorg.eclipse.persistence.internal.oxm.mappings.DirectMapping<org.eclipse.persistence.internal.sessions.AbstractSession,AttributeAccessor,org.eclipse.persistence.internal.queries.ContainerPolicy,Converter,ClassDescriptor,org.eclipse.persistence.internal.helper.DatabaseField,XMLMarshaller,Session,XMLUnmarshaller,XMLRecord>
-
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 interfaceorg.eclipse.persistence.internal.oxm.mappings.DirectMapping<org.eclipse.persistence.internal.sessions.AbstractSession,AttributeAccessor,org.eclipse.persistence.internal.queries.ContainerPolicy,Converter,ClassDescriptor,org.eclipse.persistence.internal.helper.DatabaseField,XMLMarshaller,Session,XMLUnmarshaller,XMLRecord>- Specified by:
setIsWriteOnlyin interfaceXMLMapping
-
isCloningRequired
public boolean isCloningRequired()
Description copied from class:AbstractDirectMappingINTERNAL: Return if this mapping requires its attribute value to be cloned.- Overrides:
isCloningRequiredin classAbstractDirectMapping
-
preInitialize
public void preInitialize(org.eclipse.persistence.internal.sessions.AbstractSession session) throws DescriptorExceptionDescription copied from class:AbstractDirectMappingINTERNAL: Initialize the attribute classification.- Overrides:
preInitializein classAbstractDirectMapping- Throws:
DescriptorException
-
isNormalizingStringValues
public boolean isNormalizingStringValues()
PUBLIC: Returns true if this mapping is normalizing string values on unmarshal before setting them in the object. Normalize replaces any CR, LF or Tab characters with a single space character.
-
setNormalizingStringValues
public void setNormalizingStringValues(boolean normalize)
PUBLIC: Indicates that this mapping should normalize all string values before setting them in the object on unmarshal. Normalize replaces any CR, LF or Tab characters with a single space character.- Specified by:
setNormalizingStringValuesin interfaceorg.eclipse.persistence.internal.oxm.mappings.DirectMapping<org.eclipse.persistence.internal.sessions.AbstractSession,AttributeAccessor,org.eclipse.persistence.internal.queries.ContainerPolicy,Converter,ClassDescriptor,org.eclipse.persistence.internal.helper.DatabaseField,XMLMarshaller,Session,XMLUnmarshaller,XMLRecord>- Parameters:
normalize-
-
setCollapsingStringValues
public void setCollapsingStringValues(boolean collapse)
PUBLIC: Indicates that this mapping should collapse all string values before setting them in the object on unmarshal. Collapse removes leading and trailing whitespaces, and replaces any sequence of whitepsace characters with a single space.- Specified by:
setCollapsingStringValuesin interfaceorg.eclipse.persistence.internal.oxm.mappings.DirectMapping<org.eclipse.persistence.internal.sessions.AbstractSession,AttributeAccessor,org.eclipse.persistence.internal.queries.ContainerPolicy,Converter,ClassDescriptor,org.eclipse.persistence.internal.helper.DatabaseField,XMLMarshaller,Session,XMLUnmarshaller,XMLRecord>- Parameters:
collapse-
-
isCollapsingStringValues
public boolean isCollapsingStringValues()
PUBLIC: Returns true if this mapping should collapse all string values before setting them in the object on unmarshal. Collapse removes leading and trailing whitespaces, and replaces any sequence of whitepsace characters with a single space.
-
isNullValueMarshalled
public boolean isNullValueMarshalled()
PUBLIC: Returns true if this mapping's value should be marshalled, in the case that it is equal to the default null value.
-
setNullValueMarshalled
public void setNullValueMarshalled(boolean value)
PUBLIC: Set whether this mapping's value should be marshalled, in the case that it is equal to the default null value.- Specified by:
setNullValueMarshalledin interfaceorg.eclipse.persistence.internal.oxm.mappings.DirectMapping<org.eclipse.persistence.internal.sessions.AbstractSession,AttributeAccessor,org.eclipse.persistence.internal.queries.ContainerPolicy,Converter,ClassDescriptor,org.eclipse.persistence.internal.helper.DatabaseField,XMLMarshaller,Session,XMLUnmarshaller,XMLRecord>
-
convertObjectValueToDataValue
public java.lang.Object convertObjectValueToDataValue(java.lang.Object value, Session session, XMLMarshaller marshaller)INTERNAL- Specified by:
convertObjectValueToDataValuein interfaceorg.eclipse.persistence.internal.oxm.mappings.XMLConverterMapping<XMLMarshaller,Session,XMLUnmarshaller>- Since:
- EclipseLink 2.5.0
-
convertDataValueToObjectValue
public java.lang.Object convertDataValueToObjectValue(java.lang.Object fieldValue, Session session, XMLUnmarshaller unmarshaller)INTERNAL- Specified by:
convertDataValueToObjectValuein interfaceorg.eclipse.persistence.internal.oxm.mappings.XMLConverterMapping<XMLMarshaller,Session,XMLUnmarshaller>- Since:
- EclipseLink 2.5.0
-
-