|
EclipseLink 2.2.0, build 'v20110202-r8913' API Reference | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.persistence.mappings.DatabaseMapping org.eclipse.persistence.oxm.mappings.XMLChoiceCollectionMapping
public class XMLChoiceCollectionMapping
PUBLIC:
Purpose:Provide a mapping that can map a single attribute to a number of different elements in an XML Document. This will be used to map to Choices or Substitution Groups in an XML Schema
Responsibilities:
The XMLChoiceCollectionMapping is the collection version of the XMLChoiceMapping. This mapping allows the user to specify a number of different xpaths, and types associated with those xpaths. When any of these elements are encountered in the XML Document, they are read in as the correct type and added to the collection.
Setting up XPath mappings:Unlike other OXM Mappings, instead of setting a single xpath,
the addChoiceElement method is used to specify an xpath and the type associated with this xpath.
xmlChoiceCollectionMapping.addChoiceElement("mystring/text()", String.class);
xmlChoiceCollectionMapping.addChoiceElement("myaddress", Address.class);
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.DatabaseMapping |
---|
attributeAccessor, attributeName, derivedIdMapping, derivesId, descriptor, fields, isCacheable, isJPAId, isLazy, isMapKeyMapping, isOptional, isPrimaryKeyMapping, isReadOnly, isRemotelyInitialized, mapsIdValue, NO_FIELDS, NO_WEIGHT, properties, weight, WEIGHT_AGGREGATE, WEIGHT_DIRECT, WEIGHT_TO_ONE, WEIGHT_TRANSFORM |
Constructor Summary | |
---|---|
XMLChoiceCollectionMapping()
|
Method Summary | |
---|---|
void |
addChoiceElement(java.util.List<XMLField> srcFields,
java.lang.Class elementType,
java.util.List<XMLField> tgtFields)
|
void |
addChoiceElement(java.util.List<XMLField> srcFields,
java.lang.String elementTypeName,
java.util.List<XMLField> tgtFields)
|
void |
addChoiceElement(java.lang.String xpath,
java.lang.Class elementType)
|
void |
addChoiceElement(java.lang.String srcXPath,
java.lang.Class elementType,
java.lang.String tgtXPath)
|
void |
addChoiceElement(java.lang.String xpath,
java.lang.String elementTypeName)
|
void |
addChoiceElement(java.lang.String srcXpath,
java.lang.String elementTypeName,
java.lang.String tgtXpath)
|
void |
addChoiceElement(XMLField xmlField,
java.lang.Class elementType)
|
void |
addChoiceElement(XMLField sourceField,
java.lang.Class elementType,
XMLField targetField)
|
void |
addChoiceElement(XMLField field,
java.lang.String elementTypeName)
|
void |
addConverter(XMLField field,
Converter converter)
|
void |
buildBackupClone(java.lang.Object clone,
java.lang.Object backup,
org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork)
INTERNAL: Clone the attribute from the clone and assign it to the backup. |
void |
buildClone(java.lang.Object original,
org.eclipse.persistence.internal.identitymaps.CacheKey cacheKey,
java.lang.Object clone,
org.eclipse.persistence.internal.sessions.AbstractSession cloningSession)
INTERNAL: Clone the attribute from the original and assign it to the clone. |
void |
buildCloneFromRow(org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow,
org.eclipse.persistence.internal.queries.JoinedAttributeManager joinManager,
java.lang.Object clone,
org.eclipse.persistence.internal.identitymaps.CacheKey sharedCacheKey,
ObjectBuildingQuery sourceQuery,
org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork,
org.eclipse.persistence.internal.sessions.AbstractSession executionSession)
INTERNAL: A combination of readFromRowIntoObject and buildClone. |
void |
cascadePerformRemoveIfRequired(java.lang.Object object,
org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow,
java.util.Map visitedObjects)
INTERNAL: Cascade perform delete through mappings that require the cascade |
void |
cascadeRegisterNewIfRequired(java.lang.Object object,
org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow,
java.util.Map visitedObjects)
INTERNAL: Cascade registerNew for Create through mappings that require the cascade |
protected java.util.Vector<org.eclipse.persistence.internal.helper.DatabaseField> |
collectFields()
This method must be overwritten in the subclasses to return a vector of all the fields this mapping represents. |
org.eclipse.persistence.internal.sessions.ChangeRecord |
compareForChange(java.lang.Object clone,
java.lang.Object backup,
org.eclipse.persistence.internal.sessions.ObjectChangeSet owner,
org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: This method was created in VisualAge. |
boolean |
compareObjects(java.lang.Object firstObject,
java.lang.Object secondObject,
org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Compare the attributes belonging to this mapping for the objects. |
void |
convertClassNamesToClasses(java.lang.ClassLoader classLoader)
INTERNAL: Convert all the class-name-based settings in this mapping to actual class-based settings This method is implemented by subclasses as necessary. |
void |
fixObjectReferences(java.lang.Object object,
java.util.Map objectDescriptors,
java.util.Map processedObjects,
ObjectLevelReadQuery query,
RemoteSession session)
INTERNAL: An object has been serialized from the server to the client. |
java.util.Map<XMLField,XMLMapping> |
getChoiceElementMappings()
|
java.util.ArrayList |
getChoiceFieldToClassAssociations()
|
java.util.Map<java.lang.Class,XMLField> |
getClassToFieldMappings()
|
java.util.Map<java.lang.Class,java.util.List<XMLField>> |
getClassToSourceFieldsMappings()
|
org.eclipse.persistence.internal.queries.ContainerPolicy |
getContainerPolicy()
INTERNAL: Return the mapping's containerPolicy. |
Converter |
getConverter()
Return the converter on the mapping. |
Converter |
getConverter(XMLField field)
|
java.util.Vector<org.eclipse.persistence.internal.helper.DatabaseField> |
getFields()
INTERNAL: Returns a vector of all the fields this mapping represents. |
java.util.Map<XMLField,java.lang.Class> |
getFieldToClassMappings()
|
boolean |
getReuseContainer()
Return true if the original container on the object should be used if present. |
void |
initialize(org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Allow for initialization of properties and validation. |
boolean |
isWriteOnly()
INTERNAL: Some mappings support no attribute (transformation). |
boolean |
isXMLMapping()
INTERNAL: All relational mappings should implement this method to return true. |
void |
iterate(org.eclipse.persistence.internal.descriptors.DescriptorIterator iterator)
INTERNAL: Iterate on the appropriate attribute value. |
void |
mergeChangesIntoObject(java.lang.Object target,
org.eclipse.persistence.internal.sessions.ChangeRecord changeRecord,
java.lang.Object source,
org.eclipse.persistence.internal.sessions.MergeManager mergeManager,
org.eclipse.persistence.internal.sessions.AbstractSession targetSession)
INTERNAL: Merge changes from the source to the target object. |
void |
mergeIntoObject(java.lang.Object target,
boolean isTargetUninitialized,
java.lang.Object source,
org.eclipse.persistence.internal.sessions.MergeManager mergeManager,
org.eclipse.persistence.internal.sessions.AbstractSession targetSession)
INTERNAL: Merge changes from the source to the target object. |
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 |
setChoiceFieldToClassAssociations(java.util.ArrayList associations)
|
void |
setContainerPolicy(org.eclipse.persistence.internal.queries.ContainerPolicy cp)
|
void |
setConverter(Converter converter)
Set the converter on the mapping. |
void |
setIsWriteOnly(boolean b)
|
void |
setReuseContainer(boolean reuseContainer)
Specify whether the original container on the object should be used if present. |
void |
useCollectionClass(java.lang.Class concreteContainerClass)
|
void |
useCollectionClassName(java.lang.String concreteContainerClassName)
|
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)
INTERNAL: A subclass should implement this method if it wants different behavior. |
void |
writeFromObjectIntoRow(java.lang.Object object,
org.eclipse.persistence.internal.sessions.AbstractRecord row,
org.eclipse.persistence.internal.sessions.AbstractSession session,
DatabaseMapping.WriteType writeType)
INTERNAL: A subclass should implement this method if it wants different behavior. |
void |
writeSingleValue(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. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public XMLChoiceCollectionMapping()
Method Detail |
---|
public Converter getConverter()
public void setConverter(Converter converter)
public void buildBackupClone(java.lang.Object clone, java.lang.Object backup, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork)
buildBackupClone
in class DatabaseMapping
public void buildClone(java.lang.Object original, org.eclipse.persistence.internal.identitymaps.CacheKey cacheKey, java.lang.Object clone, org.eclipse.persistence.internal.sessions.AbstractSession cloningSession)
buildClone
in class DatabaseMapping
public void buildCloneFromRow(org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow, org.eclipse.persistence.internal.queries.JoinedAttributeManager joinManager, java.lang.Object clone, org.eclipse.persistence.internal.identitymaps.CacheKey sharedCacheKey, ObjectBuildingQuery sourceQuery, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork, org.eclipse.persistence.internal.sessions.AbstractSession executionSession)
DatabaseMapping
buildClone assumes the attribute value exists on the original and can simply be copied.
readFromRowIntoObject assumes that one is building an original.
Both of the above assumptions are false in this method, and actually attempts to do both at the same time.
Extract value from the row and set the attribute to this value in the working copy clone. In order to bypass the shared cache when in transaction a UnitOfWork must be able to populate working copies directly from the row.
buildCloneFromRow
in class DatabaseMapping
public void cascadePerformRemoveIfRequired(java.lang.Object object, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow, java.util.Map visitedObjects)
cascadePerformRemoveIfRequired
in class DatabaseMapping
public void cascadeRegisterNewIfRequired(java.lang.Object object, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow, java.util.Map visitedObjects)
cascadeRegisterNewIfRequired
in class DatabaseMapping
public org.eclipse.persistence.internal.sessions.ChangeRecord compareForChange(java.lang.Object clone, java.lang.Object backup, org.eclipse.persistence.internal.sessions.ObjectChangeSet owner, org.eclipse.persistence.internal.sessions.AbstractSession session)
compareForChange
in class DatabaseMapping
public boolean compareObjects(java.lang.Object firstObject, java.lang.Object secondObject, org.eclipse.persistence.internal.sessions.AbstractSession session)
compareObjects
in class DatabaseMapping
public void fixObjectReferences(java.lang.Object object, java.util.Map objectDescriptors, java.util.Map processedObjects, ObjectLevelReadQuery query, RemoteSession session)
fixObjectReferences
in class DatabaseMapping
public void iterate(org.eclipse.persistence.internal.descriptors.DescriptorIterator iterator)
iterate
in class DatabaseMapping
public void mergeChangesIntoObject(java.lang.Object target, org.eclipse.persistence.internal.sessions.ChangeRecord changeRecord, java.lang.Object source, org.eclipse.persistence.internal.sessions.MergeManager mergeManager, org.eclipse.persistence.internal.sessions.AbstractSession targetSession)
mergeChangesIntoObject
in class DatabaseMapping
public void mergeIntoObject(java.lang.Object target, boolean isTargetUninitialized, java.lang.Object source, org.eclipse.persistence.internal.sessions.MergeManager mergeManager, org.eclipse.persistence.internal.sessions.AbstractSession targetSession)
mergeIntoObject
in class DatabaseMapping
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) throws DatabaseException
DatabaseMapping
valueFromRow
in class DatabaseMapping
DatabaseException
public void writeFromObjectIntoRow(java.lang.Object object, org.eclipse.persistence.internal.sessions.AbstractRecord row, org.eclipse.persistence.internal.sessions.AbstractSession session, DatabaseMapping.WriteType writeType) throws DescriptorException
DatabaseMapping
writeFromObjectIntoRow
in class DatabaseMapping
DescriptorException
public void writeSingleValue(java.lang.Object value, java.lang.Object parent, XMLRecord row, org.eclipse.persistence.internal.sessions.AbstractSession session)
XMLMapping
writeSingleValue
in interface XMLMapping
value
- - The value to be marshalledrow
- - The Record the value is being marshalled too.public boolean isXMLMapping()
DatabaseMapping
isXMLMapping
in class DatabaseMapping
public java.util.Vector<org.eclipse.persistence.internal.helper.DatabaseField> getFields()
DatabaseMapping
getFields
in class DatabaseMapping
protected java.util.Vector<org.eclipse.persistence.internal.helper.DatabaseField> collectFields()
DatabaseMapping
collectFields
in class DatabaseMapping
public void addChoiceElement(java.lang.String xpath, java.lang.Class elementType)
public void addChoiceElement(java.lang.String xpath, java.lang.String elementTypeName)
public void addChoiceElement(XMLField xmlField, java.lang.Class elementType)
public void addChoiceElement(java.util.List<XMLField> srcFields, java.lang.Class elementType, java.util.List<XMLField> tgtFields)
public void addChoiceElement(java.util.List<XMLField> srcFields, java.lang.String elementTypeName, java.util.List<XMLField> tgtFields)
public void addChoiceElement(java.lang.String srcXPath, java.lang.Class elementType, java.lang.String tgtXPath)
public void addChoiceElement(java.lang.String srcXpath, java.lang.String elementTypeName, java.lang.String tgtXpath)
public void addChoiceElement(XMLField sourceField, java.lang.Class elementType, XMLField targetField)
public void addChoiceElement(XMLField field, java.lang.String elementTypeName)
public java.util.Map<XMLField,java.lang.Class> getFieldToClassMappings()
public void initialize(org.eclipse.persistence.internal.sessions.AbstractSession session) throws DescriptorException
DatabaseMapping
initialize
in class DatabaseMapping
DescriptorException
public java.util.Map<java.lang.Class,XMLField> getClassToFieldMappings()
public java.util.Map<XMLField,XMLMapping> getChoiceElementMappings()
public org.eclipse.persistence.internal.queries.ContainerPolicy getContainerPolicy()
DatabaseMapping
getContainerPolicy
in class DatabaseMapping
public void setContainerPolicy(org.eclipse.persistence.internal.queries.ContainerPolicy cp)
public void useCollectionClass(java.lang.Class concreteContainerClass)
public void useCollectionClassName(java.lang.String concreteContainerClassName)
public void convertClassNamesToClasses(java.lang.ClassLoader classLoader)
DatabaseMapping
convertClassNamesToClasses
in class DatabaseMapping
public void addConverter(XMLField field, Converter converter)
public Converter getConverter(XMLField field)
public java.util.ArrayList getChoiceFieldToClassAssociations()
public void setChoiceFieldToClassAssociations(java.util.ArrayList associations)
public boolean isWriteOnly()
DatabaseMapping
isWriteOnly
in interface XMLMapping
isWriteOnly
in class DatabaseMapping
public void setIsWriteOnly(boolean b)
setIsWriteOnly
in interface XMLMapping
public void preInitialize(org.eclipse.persistence.internal.sessions.AbstractSession session) throws DescriptorException
DatabaseMapping
preInitialize
in class DatabaseMapping
DescriptorException
public void setAttributeValueInObject(java.lang.Object object, java.lang.Object value) throws DescriptorException
DatabaseMapping
setAttributeValueInObject
in class DatabaseMapping
DescriptorException
public boolean getReuseContainer()
public void setReuseContainer(boolean reuseContainer)
public java.util.Map<java.lang.Class,java.util.List<XMLField>> getClassToSourceFieldsMappings()
|
EclipseLink 2.2.0, build 'v20110202-r8913' API Reference | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |