public class MapContainerPolicy extends InterfaceContainerPolicy
Purpose: A MapContainerPolicy is ContainerPolicy whose container class implements the Map interface.
Responsibilities: Provide the functionality to operate on an instance of a Map.
ContainerPolicy
,
CollectionContainerPolicy
,
Serialized FormModifier and Type | Field and Description |
---|---|
protected Class |
elementClass |
protected String |
elementClassName |
protected Field |
keyField |
protected Method |
keyMethod |
protected String |
keyName |
cloneMethod, containerClass, containerClassName
constructor, elementDescriptor
Constructor and Description |
---|
MapContainerPolicy()
INTERNAL:
Construct a new policy.
|
MapContainerPolicy(Class containerClass)
INTERNAL:
Construct a new policy for the specified class.
|
MapContainerPolicy(String containerClassName)
INTERNAL:
Construct a new policy for the specified class name.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addInto(Object key,
Object element,
Object container,
AbstractSession session)
INTERNAL:
Add element into container which implements the Map interface.
|
void |
clear(Object container)
INTERNAL:
Remove all the elements from container.
|
boolean |
compareKeys(Object sourceValue,
AbstractSession session)
INTERNAL:
Return true if keys are the same in the source as the backup.
|
protected boolean |
contains(Object element,
Object container)
INTERNAL:
Return the true if element exists in container.
|
void |
convertClassNamesToClasses(ClassLoader classLoader)
INTERNAL:
Convert all the class-name-based settings in this ContainerPolicy to
actual class-based settings.
|
Class |
getElementClass()
INTERNAL:
Returns the element class which defines the map key.
|
String |
getElementClassName()
INTERNAL:
Returns the element class name which defines the map key.
|
Class |
getInterfaceType()
INTERNAL:
|
String |
getKeyName()
INTERNAL:
Returns the key name which will return the value of the key to be used
in the container.
|
boolean |
isMapPolicy()
INTERNAL
Yes this is a MapPolicy
|
boolean |
isValidContainer(Object container)
INTERNAL:
Validate the container type.
|
Object |
iteratorFor(Object container)
INTERNAL:
Return an Iterator for the given container.
|
Object |
keyFrom(Object element,
AbstractSession session)
INTERNAL:
Return the key for the specified element.
|
void |
prepare(DatabaseQuery query,
AbstractSession session)
Prepare and validate.
|
boolean |
removeFrom(Object key,
Object element,
Object container,
AbstractSession session)
INTERNAL:
Remove element from container which implements the Map interface.
|
boolean |
removeFromWithIdentity(Object element,
Object container,
AbstractSession session)
INTERNAL:
Remove element from container which implements the Map interface.
|
void |
setElementClass(Class elementClass)
INTERNAL:
Sets the element class which defines the method.
|
void |
setKeyName(String keyName)
INTERNAL:
Sets the key name to be used to generate the key in a Map type container
class.
|
void |
setKeyName(String keyName,
String elementClassName)
INTERNAL:
Sets the key name to be used to generate the key in a Map type container
class.
|
int |
sizeFor(Object container)
INTERNAL:
Return the size of container.
|
void |
validateElementAndRehashIfRequired(Object sourceValue,
Object targetMap,
AbstractSession session,
Object targetVersionOfSource)
INTERNAL:
If the key has changed, remove the element and add it back into the target.
|
cloneFor, getCloneMethod, getCloneMethod, getContainerClass, getContainerClassName, hasNext, invokeCloneMethodOn, isValidContainerType, next, setCloneMethod, setContainerClass, setContainerClassName, toStringInfo
addInto, addInto, addIntoWithOrder, addIntoWithOrder, addIntoWithOrder, buildContainerFromVector, buildPolicyFor, buildPolicyFor, clone, clone, compareCollectionsForChange, concatenateContainers, containerInstance, containerInstance, contains, containsKey, execute, getConstructor, getElementDescriptor, hasElementDescriptor, hasOrder, initializeConstructor, isCollectionPolicy, isCursoredStreamPolicy, isCursorPolicy, isCursorStreamPolicy, isDirectMapPolicy, isEmpty, isListPolicy, isScrollableCursorPolicy, mergeCascadeParts, mergeChanges, next, overridesRead, prepareForExecution, recordAddToCollectionInChangeRecord, recordRemoveFromCollectionInChangeRecord, remoteExecute, removeAllElements, removeFrom, removeFrom, removeFromWithOrder, setConstructor, setElementDescriptor, toString, vectorFor
protected String keyName
protected String elementClassName
protected Class elementClass
protected transient Field keyField
protected transient Method keyMethod
public MapContainerPolicy()
public MapContainerPolicy(Class containerClass)
public MapContainerPolicy(String containerClassName)
public void prepare(DatabaseQuery query, AbstractSession session) throws QueryException
prepare
in class ContainerPolicy
QueryException
public boolean addInto(Object key, Object element, Object container, AbstractSession session)
addInto
in class ContainerPolicy
public void clear(Object container)
clear
in class ContainerPolicy
public boolean compareKeys(Object sourceValue, AbstractSession session)
compareKeys
in class ContainerPolicy
protected boolean contains(Object element, Object container)
contains
in class ContainerPolicy
public void convertClassNamesToClasses(ClassLoader classLoader)
convertClassNamesToClasses
in class InterfaceContainerPolicy
classLoader
- public Class getElementClass()
public String getElementClassName()
public Class getInterfaceType()
getInterfaceType
in class InterfaceContainerPolicy
public String getKeyName()
public boolean isMapPolicy()
isMapPolicy
in class ContainerPolicy
public Object iteratorFor(Object container)
iteratorFor
in class ContainerPolicy
ContainerPolicy.hasNext(java.lang.Object)
,
ContainerPolicy.next(java.lang.Object)
public Object keyFrom(Object element, AbstractSession session)
keyFrom
in class ContainerPolicy
element
- java.lang.Objectpublic boolean removeFrom(Object key, Object element, Object container, AbstractSession session)
removeFrom
in class ContainerPolicy
public boolean removeFromWithIdentity(Object element, Object container, AbstractSession session)
public void setElementClass(Class elementClass)
public boolean isValidContainer(Object container)
isValidContainer
in class ContainerPolicy
CollectionContainerPolicy.isValidContainer(Object)
,
isValidContainer(Object)
public void setKeyName(String keyName, String elementClassName)
setKeyName
in class ContainerPolicy
#MapContainerPolicy
public void setKeyName(String keyName)
public int sizeFor(Object container)
sizeFor
in class ContainerPolicy
public void validateElementAndRehashIfRequired(Object sourceValue, Object targetMap, AbstractSession session, Object targetVersionOfSource)
validateElementAndRehashIfRequired
in class ContainerPolicy
Copyright © 2022. All rights reserved.