FileDocCategorySizeDatePackage
ListContainerPolicy.javaAPI DocGlassfish v2 API5714Tue May 22 16:54:40 BST 2007oracle.toplink.essentials.internal.queryframework

ListContainerPolicy

public class ListContainerPolicy extends CollectionContainerPolicy

Purpose: A ListContainerPolicy is ContainerPolicy whose container class implements the List interface. This signifies that the collection has order

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

see
ContainerPolicy
see
CollectionContainerPolicy

Fields Summary
Constructors Summary
public ListContainerPolicy()
INTERNAL: Construct a new policy.

        super();
    
public ListContainerPolicy(Class containerClass)
INTERNAL: Construct a new policy for the specified class.

        super(containerClass);
    
public ListContainerPolicy(String containerClassName)
INTERNAL: Construct a new policy for the specified class name.

        super(containerClassName);
    
Methods Summary
public booleanhasOrder()
INTERNAL: Returns true if the collection has order.

        return true;
    
public booleanisListPolicy()
INTERNAL: Returns true if this is a ListContainerPolicy.

        return true;
    
public booleanisValidContainer(java.lang.Object container)
INTERNAL: Validate the container type.

        // PERF: Use instanceof which is inlined, not isAssignable which is very inefficent.
        return container instanceof List;
    
public voidrecordAddToCollectionInChangeRecord(oracle.toplink.essentials.internal.sessions.ObjectChangeSet changeSetToAdd, oracle.toplink.essentials.internal.sessions.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. Each containerplicy type will implement specific behaviour for the collection type it is wrapping. These methods are only valid for collections containing object references.

        if (collectionChangeRecord.getRemoveObjectList().containsKey(changeSetToAdd)) {
            collectionChangeRecord.getRemoveObjectList().remove(changeSetToAdd);
        } else {
            if (collectionChangeRecord.getAddObjectList().contains(changeSetToAdd)) {
                collectionChangeRecord.getAddOverFlow().add(changeSetToAdd);
            } else {
                collectionChangeRecord.getAddObjectList().put(changeSetToAdd, changeSetToAdd);
            }
        }
    
public voidrecordRemoveFromCollectionInChangeRecord(oracle.toplink.essentials.internal.sessions.ObjectChangeSet changeSetToRemove, oracle.toplink.essentials.internal.sessions.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. Each container policy type will implement specific behaviour for the collection type it is wrapping. These methods are only valid for collections containing object references.

        if (collectionChangeRecord.getAddObjectList().containsKey(changeSetToRemove)) {
            if (collectionChangeRecord.getAddOverFlow().contains(changeSetToRemove)){
                collectionChangeRecord.getAddOverFlow().remove(changeSetToRemove);
            } else {
                collectionChangeRecord.getAddObjectList().remove(changeSetToRemove);
            }
        } else {
            collectionChangeRecord.getRemoveObjectList().put(changeSetToRemove, changeSetToRemove);
        }