Top Description Inners Fields Constructors Methods
org.eclipse.persistence.internal.queries

public Class MapContainerPolicy

extends InterfaceContainerPolicy
Class Inheritance
Known Direct Subclasses
org.eclipse.persistence.internal.queries.MappedKeyMapContainerPolicy
Imports
java.lang.reflect.Field, .InvocationTargetException, .Method, java.security.AccessController, .PrivilegedActionException, java.util.Iterator, .Map, .Map.Entry, org.eclipse.persistence.descriptors.ClassDescriptor, org.eclipse.persistence.descriptors.changetracking.CollectionChangeEvent, .MapChangeEvent, org.eclipse.persistence.exceptions.QueryException, .ValidationException, org.eclipse.persistence.internal.helper.ClassConstants, .DatabaseField, .Helper, org.eclipse.persistence.internal.identitymaps.CacheKey, org.eclipse.persistence.internal.security.PrivilegedAccessHelper, .PrivilegedClassForName, .PrivilegedGetValueFromField, .PrivilegedMethodInvoker, org.eclipse.persistence.internal.sessions.AbstractRecord, .AbstractSession, .CollectionChangeRecord, .MergeManager, .ObjectChangeSet, .UnitOfWorkChangeSet, .UnitOfWorkImpl, org.eclipse.persistence.mappings.Association, .CollectionMapping, .DatabaseMapping, .ForeignReferenceMapping, .ObjectReferenceMapping, org.eclipse.persistence.mappings.querykeys.QueryKey, org.eclipse.persistence.queries.DatabaseQuery

Purpose: A MapContainerPolicy is ContainerPolicy whose container class implements the Map interface.

Responsibilities: Provide the functionality to operate on an instance of a Map.

See Also
ContainerPolicy, CollectionContainerPolicy

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
MapContainerPolicy.MapContainerPolicyIterator

INTERNAL: This inner class is used to iterate through the Map.Entry s of a Map.

Field Summary

Modifier and TypeField and Description
protected Class<?>
protected String
protected transient Field
protected transient Method
protected String
keyName

The Method which is called on each value added to the Map and whose result is used as key to the value.

Inherited from org.eclipse.persistence.internal.queries.InterfaceContainerPolicy:
cloneMethodcontainerClasscontainerClassName

Constructor Summary

AccessConstructor and Description
public
MapContainerPolicy()

INTERNAL: Construct a new policy.

public
MapContainerPolicy(Class<?> containerClass)

INTERNAL: Construct a new policy for the specified class.

public
MapContainerPolicy(String containerClassName)

INTERNAL: Construct a new policy for the specified class name.

Method Summary

Modifier and TypeMethod and Description
public boolean
public boolean
addInto(Object key, Object element, Object container, AbstractSession session)

Overrides org.eclipse.persistence.internal.queries.ContainerPolicy.addInto.

Implements org.eclipse.persistence.internal.core.queries.CoreContainerPolicy.addInto.

INTERNAL: Add element into container which implements the Map interface.
public void
addNextValueFromIteratorInto(Object valuesIterator, Object parent, CacheKey parentCacheKey, Object toCollection, CollectionMapping mapping, Integer refreshCascade, AbstractSession cloningSession, boolean isExisting, boolean isFromSharedCache)

Overrides org.eclipse.persistence.internal.queries.ContainerPolicy.addNextValueFromIteratorInto.

INTERNAL: This method is used to add the next value from an iterator built using ContainerPolicy's iteratorFor() method into the toCollection.
public void
buildChangeSetForNewObjectInCollection(Object object, ClassDescriptor referenceDescriptor, UnitOfWorkChangeSet uowChangeSet, AbstractSession session)

Overrides org.eclipse.persistence.internal.queries.ContainerPolicy.buildChangeSetForNewObjectInCollection.

INTERNAL: Ensure the new key is set for the change set for a new map object
protected Object
buildCloneForValue(Object value, Object parent, CacheKey parentCacheKey, CollectionMapping mapping, Integer refreshCascade, AbstractSession cloningSession, boolean isExisting, boolean isFromSharedCache)

Build a clone for the value in a mapping.

public Object
buildCollectionEntry(Object objectAdded, ObjectChangeSet changeSet)

Overrides org.eclipse.persistence.internal.queries.ContainerPolicy.buildCollectionEntry.

INTERNAL: Return an object representing an entry in the collection represented by this container policy This method will returns an Association containing the key and the value for a Map
public Object[]
buildReferencesPKList(Object container, AbstractSession session)

Overrides org.eclipse.persistence.internal.queries.ContainerPolicy.buildReferencesPKList.

INTERNAL: This method will access the target relationship and create a list of information to rebuild the collection.
public void
public Object
cloneFor(Object container)

Overrides org.eclipse.persistence.internal.queries.InterfaceContainerPolicy.cloneFor.

INTERNAL: Return a clone of the specified container.
public boolean
compareKeys(Object sourceValue, AbstractSession session)

Overrides org.eclipse.persistence.internal.queries.ContainerPolicy.compareKeys.

INTERNAL: Return true if keys are the same in the source as the backup.
public Object
concatenateContainers(Object firstContainer, Object secondContainer, AbstractSession session)

Overrides org.eclipse.persistence.internal.queries.ContainerPolicy.concatenateContainers.

INTERNAL: Build a new container, add the contents of each of the specified containers to it, and return it.
protected boolean

Returns:

boolean true if container 'contains' element
contains
(Object element, Object container)

Overrides org.eclipse.persistence.internal.queries.ContainerPolicy.contains.

INTERNAL: Return the true if element exists in container.
public void
convertClassNamesToClasses(ClassLoader classLoader)

Overrides org.eclipse.persistence.internal.queries.InterfaceContainerPolicy.convertClassNamesToClasses.

INTERNAL: Convert all the class-name-based settings in this ContainerPolicy to actual class-based settings.
public CollectionChangeEvent
createChangeEvent(Object collectionOwner, String propertyName, Object collectionChanged, Object elementChanged, int changeType, Integer index, boolean isChangeApplied)

Overrides org.eclipse.persistence.internal.queries.InterfaceContainerPolicy.createChangeEvent.

INTERNAL: Creates a CollectionChangeEvent for the container
public QueryKey
public Object
createWrappedObjectFromExistingWrappedObject(Object wrappedObject, Object
if this is an aggregate, the owner of the aggregate
parent
,
ClassDescriptor referenceDescriptor, MergeManager mergeManager, AbstractSession targetSession)

Overrides org.eclipse.persistence.internal.queries.ContainerPolicy.createWrappedObjectFromExistingWrappedObject.

INTERNAL: This method will actually potentially wrap an object in two ways.
public DatabaseField
getDirectKeyField(CollectionMapping baseMapping)

Overrides org.eclipse.persistence.internal.queries.InterfaceContainerPolicy.getDirectKeyField.

INTERNAL: Return the DatabaseField that represents the key in a DirectMapMapping.
public Class<?>
getElementClass()

INTERNAL: Returns the element class which defines the map key.

public String
getElementClassName()

INTERNAL: Returns the element class name which defines the map key.

public Class<?>
public String
getKeyName()

INTERNAL: Returns the key name which will return the value of the key to be used in the container.

public Object
getKeyType()

Overrides org.eclipse.persistence.internal.queries.ContainerPolicy.getKeyType.

INTERNAL: Return the type of the map key, this will be overridden by container policies that allow maps.
public boolean
protected void
initializeKey()

INTERNAL: Set the keyMethod or keyField based on the keyName.

protected boolean
isKeyAvailableFromElement()

MapContainerPolicy is for mappings where the key is stored in actual element.

public boolean
isMapKeyAttribute()

Overrides org.eclipse.persistence.internal.queries.InterfaceContainerPolicy.isMapKeyAttribute.

INTERNAL: Return whether a map key this container policy represents is an attribute.
public boolean
public boolean
public Object
public Object
keyFrom(Object element, AbstractSession session)

Overrides org.eclipse.persistence.internal.queries.ContainerPolicy.keyFrom.

INTERNAL: Return the key for the specified element.
public Object
keyFromEntry(Object entry)

Overrides org.eclipse.persistence.internal.queries.ContainerPolicy.keyFromEntry.

Get the key from the passed in Map.Entry.
public Object
protected Object
next(Object iterator)

Overrides org.eclipse.persistence.internal.queries.InterfaceContainerPolicy.next.

INTERNAL: Return the next object on the queue.
public Object
public Object
public void
public void
recordUpdateToCollectionInChangeRecord(CollectionChangeEvent event, ObjectChangeSet changeSet, CollectionChangeRecord collectionChangeRecord)

Overrides org.eclipse.persistence.internal.queries.ContainerPolicy.recordUpdateToCollectionInChangeRecord.

This method is used to bridge the behavior between Attribute Change Tracking and deferred change tracking with respect to adding the same instance multiple times.
public boolean
removeFrom(Object key, Object element, Object container, AbstractSession session)

Overrides org.eclipse.persistence.internal.queries.ContainerPolicy.removeFrom.

INTERNAL: Remove element from container which implements the Map interface.
public void
setElementClass(Class<?> elementClass)

INTERNAL: Sets the element class which defines the method.

public void
setKeyMethod(String keyMethodName, Class<?> elementClass)

INTERNAL: Sets the Method to be used to generate the key in a Map type container class.

public void
setKeyMethod(String keyMethodName, String elementClassName)

INTERNAL: Sets the Method to be used to generate the key in a Map type container class.

public void
setKeyMethodName(String keyMethodName)

INTERNAL: Sets the Method to be used to generate the key in a Map type container class.

public void
setKeyName(String keyName, String elementClassName)

Overrides org.eclipse.persistence.internal.queries.ContainerPolicy.setKeyName.

INTERNAL: Sets the key name to be used to generate the key in a Map type container class.
public void
setKeyName(String keyName, Class<?> elementClass)

Overrides org.eclipse.persistence.internal.queries.ContainerPolicy.setKeyName.

INTERNAL: Sets the key name to be used to generate the key in a Map type container class.
public void
setKeyName(String keyName)

INTERNAL: Sets the key name to be used to generate the key in a Map type container class.

public int
public Object
unwrapElement(Object object)

Overrides org.eclipse.persistence.internal.queries.ContainerPolicy.unwrapElement.

INTERNAL: MapContainerPolicy's iterator iterates on the Entries of a Map.
public Object
unwrapIteratorResult(Object object)

Overrides org.eclipse.persistence.internal.queries.ContainerPolicy.unwrapIteratorResult.

INTERNAL: MapContainerPolicy's iterator iterates on the Entries of a Map.
public Object
unwrapKey(Object key, AbstractSession session)

INTERNAL: Allow the key to be unwrapped.

public Object
valueFromPKList(Object[] pks, AbstractRecord foreignKeys, ForeignReferenceMapping mapping, AbstractSession session)

Overrides org.eclipse.persistence.internal.queries.ContainerPolicy.valueFromPKList.

INTERNAL: This method is used to load a relationship from a list of PKs.
Inherited from org.eclipse.persistence.internal.queries.InterfaceContainerPolicy:
buildContainerFromVectorequalsgetCloneMethodgetCloneMethodgetContainerClassgetContainerClassNamehashCodeinvokeCloneMethodOnisValidContainerTypesetCloneMethodsetContainerClasssetContainerClassNametoStringInfo