public abstract class ContainerPolicy extends Object implements Cloneable, Serializable
Purpose: Used to support collections in read queries.
Responsibilities: Map the results into the appropriate collection instance. Generically support special collections like cursored stream and virtual collection.
Modifier and Type | Field and Description |
---|---|
protected Constructor |
constructor |
protected ClassDescriptor |
elementDescriptor
The descriptor is used to wrap and unwrap objects using the wrapper policy.
|
Constructor and Description |
---|
ContainerPolicy()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addInto(Object element,
Object container,
AbstractSession session)
INTERNAL:
Add element to container.
|
protected boolean |
addInto(Object key,
Object element,
Object container)
INTERNAL:
Add element to container however that needs to be done for the type of container.
|
boolean |
addInto(Object key,
Object element,
Object container,
AbstractSession session)
INTERNAL:
Add element to container.
|
void |
addIntoWithOrder(Integer index,
Object element,
Object container)
INTERNAL:
It is illegal to send this message to this receiver.
|
void |
addIntoWithOrder(Integer index,
Object element,
Object container,
AbstractSession session)
INTERNAL:
It is illegal to send this message to this receiver.
|
void |
addIntoWithOrder(Vector indexes,
Hashtable elements,
Object container,
AbstractSession session)
INTERNAL:
It is illegal to send this message to this receiver.
|
Object |
buildContainerFromVector(Vector vector,
AbstractSession session)
INTERNAL:
Return a container populated with the contents of the specified Vector.
|
static ContainerPolicy |
buildPolicyFor(Class concreteContainerClass)
INTERNAL:
Return the appropriate container policy for the specified
concrete container class.
|
static ContainerPolicy |
buildPolicyFor(Class concreteContainerClass,
boolean hasOrdering)
INTERNAL:
Return the appropriate container policy for the specified
concrete container class.
|
void |
clear(Object container)
INTERNAL:
Remove all the elements from the specified container.
|
Object |
clone() |
ContainerPolicy |
clone(ReadQuery query) |
Object |
cloneFor(Object container)
INTERNAL:
Return a clone of the specified container.
|
void |
compareCollectionsForChange(Object oldCollection,
Object newCollection,
CollectionChangeRecord changeRecord,
AbstractSession session,
ClassDescriptor referenceDescriptor)
INTERNAL:
This method is used to calculate the differences between two collections.
|
boolean |
compareKeys(Object sourceKey,
AbstractSession session)
INTERNAL:
Return true if keys are the same in the source as the backup.
|
Object |
concatenateContainers(Object firstContainer,
Object secondContainer)
INTERNAL:
Build a new container, add the contents of each of the specified containers
to it, and return it.
|
Object |
containerInstance()
INTERNAL:
Return an instance of the container class.
|
Object |
containerInstance(int initialCapacity)
INTERNAL:
Return an instance of the container class with the specified initial capacity.
|
protected boolean |
contains(Object element,
Object container)
INTERNAL:
Return whether element exists in container.
|
boolean |
contains(Object element,
Object container,
AbstractSession session)
INTERNAL:
Check if the object is contained in the collection.
|
protected boolean |
containsKey(Object element,
Object container)
INTERNAL:
Return whether element exists in container.
|
void |
convertClassNamesToClasses(ClassLoader classLoader)
INTERNAL:
Convert all the class-name-based settings in this ContainerPolicy to actual class-based
settings
This method is implemented by subclasses as necessary.
|
Object |
execute()
INTERNAL:
This can be used by collection such as cursored stream to gain control over execution.
|
protected Constructor |
getConstructor()
INTERNAL:
Return the size constructor if available.
|
Class |
getContainerClass()
INTERNAL:
Return the class used for the container.
|
String |
getContainerClassName()
INTERNAL:
Used by the MW
|
ClassDescriptor |
getElementDescriptor()
INTERNAL:
Used for wrapping and unwrapping with the wrapper policy.
|
boolean |
hasElementDescriptor()
INTERNAL:
Used for wrapping and unwrapping with the wrapper policy.
|
abstract boolean |
hasNext(Object iterator)
INTERNAL:
Return whether the iterator has more objects.
|
boolean |
hasOrder()
INTERNAL:
Returns true if the collection has order
|
void |
initializeConstructor()
INTERNAL:
Find the size constructor.
|
boolean |
isCollectionPolicy() |
boolean |
isCursoredStreamPolicy()
Is this a Cursored stream?
|
boolean |
isCursorPolicy() |
boolean |
isCursorStreamPolicy() |
boolean |
isDirectMapPolicy() |
boolean |
isEmpty(Object container)
INTERNAL:
Return whether the container is empty.
|
boolean |
isListPolicy() |
boolean |
isMapPolicy() |
boolean |
isScrollableCursorPolicy() |
boolean |
isValidContainer(Object container)
INTERNAL:
Return whether the specified object is of a valid container type.
|
boolean |
isValidContainerType(Class containerType)
INTERNAL:
Return whether the specified type is a valid container type.
|
abstract 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.
|
Object |
mergeCascadeParts(ObjectChangeSet objectChanges,
MergeManager mergeManager,
AbstractSession parentSession)
INTERNAL:
Merge changes from the source to the target object.
|
void |
mergeChanges(CollectionChangeRecord changeRecord,
Object valueOfTarget,
boolean shouldMergeCascadeParts,
MergeManager mergeManager,
AbstractSession parentSession)
INTERNAL:
Merge changes from the source to the target object.
|
protected abstract Object |
next(Object iterator)
INTERNAL:
Return the next object on the queue.
|
Object |
next(Object iterator,
AbstractSession session)
INTERNAL:
Return the next object from the iterator.
|
boolean |
overridesRead()
This can be used by collection such as cursored stream to gain control over execution.
|
void |
prepare(DatabaseQuery query,
AbstractSession session)
Prepare and validate.
|
void |
prepareForExecution()
Prepare and validate.
|
void |
recordAddToCollectionInChangeRecord(ObjectChangeSet changeSetToAdd,
CollectionChangeRecord collectionChangeRecord)
This method is used to bridge the behaviour between Attribute Change Tracking and
deferred change tracking with respect to adding the same instance multiple times.
|
void |
recordRemoveFromCollectionInChangeRecord(ObjectChangeSet changeSetToRemove,
CollectionChangeRecord collectionChangeRecord)
This method is used to bridge the behaviour between Attribute Change Tracking and
deferred change tracking with respect to adding the same instance multiple times.
|
Object |
remoteExecute()
This can be used by collection such as cursored stream to gain control over execution.
|
void |
removeAllElements(Object container)
INTERNAL:
Remove all the elements from container.
|
boolean |
removeFrom(Object element,
Object container,
AbstractSession session)
INTERNAL:
Remove the object from the collection.
|
protected boolean |
removeFrom(Object key,
Object element,
Object container)
INTERNAL:
Remove element from container.
|
boolean |
removeFrom(Object key,
Object element,
Object container,
AbstractSession session)
INTERNAL:
Remove the object from the collection.
|
void |
removeFromWithOrder(int beginIndex,
Object container)
INTERNAL:
It is illegal to send this message to this receiver.
|
protected void |
setConstructor(Constructor constructor)
INTERNAL:
Set the size constructor if available.
|
void |
setContainerClass(Class containerClass)
INTERNAL:
Set the class used for the container.
|
void |
setContainerClassName(String containerClassName)
INTERNAL:
Used by the MW
|
void |
setElementDescriptor(ClassDescriptor elementDescriptor)
INTERNAL:
Used for wrapping and unwrapping with the wrapper policy.
|
void |
setKeyName(String instanceVariableName,
String elementClassName)
INTERNAL:
It is illegal to send this message to this receiver.
|
int |
sizeFor(Object container)
INTERNAL:
Return the size of container.
|
String |
toString() |
protected Object |
toStringInfo() |
void |
validateElementAndRehashIfRequired(Object sourceValue,
Object target,
AbstractSession session,
Object targetVersionOfSource)
INTERNAL:
over ride in MapPolicy subclass
|
Vector |
vectorFor(Object container,
AbstractSession session)
INTERNAL:
Return a Vector populated with the contents of container.
|
protected transient ClassDescriptor elementDescriptor
protected transient Constructor constructor
protected boolean addInto(Object key, Object element, Object container)
public boolean addInto(Object element, Object container, AbstractSession session)
public boolean addInto(Object key, Object element, Object container, AbstractSession session)
public void addIntoWithOrder(Integer index, Object element, Object container)
#ListContainerPolicy
public void addIntoWithOrder(Integer index, Object element, Object container, AbstractSession session)
#ListContainerPolicy
public void addIntoWithOrder(Vector indexes, Hashtable elements, Object container, AbstractSession session)
#ListContainerPolicy
public Object buildContainerFromVector(Vector vector, AbstractSession session)
public static ContainerPolicy buildPolicyFor(Class concreteContainerClass)
public static ContainerPolicy buildPolicyFor(Class concreteContainerClass, boolean hasOrdering)
public void clear(Object container)
public ContainerPolicy clone(ReadQuery query)
public Object cloneFor(Object container)
public void compareCollectionsForChange(Object oldCollection, Object newCollection, CollectionChangeRecord changeRecord, AbstractSession session, ClassDescriptor referenceDescriptor)
public boolean compareKeys(Object sourceKey, AbstractSession session)
public Object concatenateContainers(Object firstContainer, Object secondContainer)
public Object containerInstance()
public Object containerInstance(int initialCapacity)
protected boolean contains(Object element, Object container)
public boolean contains(Object element, Object container, AbstractSession session)
protected boolean containsKey(Object element, Object container)
public void convertClassNamesToClasses(ClassLoader classLoader)
classLoader
- public Object execute()
protected Constructor getConstructor()
public Class getContainerClass()
public String getContainerClassName()
public ClassDescriptor getElementDescriptor()
public boolean hasElementDescriptor()
public abstract boolean hasNext(Object iterator)
iteratorFor(java.lang.Object)
public boolean hasOrder()
public void initializeConstructor()
public boolean isCollectionPolicy()
public boolean isCursoredStreamPolicy()
public boolean isCursorPolicy()
public boolean isCursorStreamPolicy()
public boolean isDirectMapPolicy()
public boolean isEmpty(Object container)
public boolean isListPolicy()
public boolean isMapPolicy()
public boolean isScrollableCursorPolicy()
public boolean isValidContainer(Object container)
public boolean isValidContainerType(Class containerType)
public abstract Object iteratorFor(Object container)
hasNext(java.lang.Object)
,
next(java.lang.Object)
public Object keyFrom(Object element, AbstractSession session)
element
- java.lang.Objectpublic Object mergeCascadeParts(ObjectChangeSet objectChanges, MergeManager mergeManager, AbstractSession parentSession)
public void mergeChanges(CollectionChangeRecord changeRecord, Object valueOfTarget, boolean shouldMergeCascadeParts, MergeManager mergeManager, AbstractSession parentSession)
protected abstract Object next(Object iterator)
iteratorFor(java.lang.Object)
public Object next(Object iterator, AbstractSession session)
public boolean overridesRead()
public void prepare(DatabaseQuery query, AbstractSession session) throws QueryException
QueryException
public void prepareForExecution() throws QueryException
QueryException
public void recordAddToCollectionInChangeRecord(ObjectChangeSet changeSetToAdd, CollectionChangeRecord collectionChangeRecord)
public void recordRemoveFromCollectionInChangeRecord(ObjectChangeSet changeSetToRemove, CollectionChangeRecord collectionChangeRecord)
public Object remoteExecute()
public void removeAllElements(Object container)
protected boolean removeFrom(Object key, Object element, Object container)
public boolean removeFrom(Object key, Object element, Object container, AbstractSession session)
public boolean removeFrom(Object element, Object container, AbstractSession session)
public void removeFromWithOrder(int beginIndex, Object container)
#ListContainerPolicy
protected void setConstructor(Constructor constructor)
public void setContainerClass(Class containerClass)
public void setContainerClassName(String containerClassName)
public void setElementDescriptor(ClassDescriptor elementDescriptor)
public void setKeyName(String instanceVariableName, String elementClassName)
#MapContainerPolicy
public int sizeFor(Object container)
protected Object toStringInfo()
public void validateElementAndRehashIfRequired(Object sourceValue, Object target, AbstractSession session, Object targetVersionOfSource)
public Vector vectorFor(Object container, AbstractSession session)
Copyright © 2023. All rights reserved.