Class InterfaceContainerPolicy

java.lang.Object
org.eclipse.persistence.internal.queries.ContainerPolicy
org.eclipse.persistence.internal.queries.InterfaceContainerPolicy
All Implemented Interfaces:
Serializable, Cloneable, CoreContainerPolicy<AbstractSession>
Direct Known Subclasses:
CollectionContainerPolicy, MapContainerPolicy

public abstract class InterfaceContainerPolicy extends ContainerPolicy

Purpose: The abstract class for ContainerPolicy's whose container class implements a container interface.

See Also:
  • Field Details

    • containerClass

      protected Class<?> containerClass
      The concrete container class.
    • containerClassName

      protected String containerClassName
    • cloneMethod

      protected transient Method cloneMethod
      The method which will return a clone of an instance of the containerClass.
  • Constructor Details

    • InterfaceContainerPolicy

      protected InterfaceContainerPolicy()
      INTERNAL: Construct a new policy.
    • InterfaceContainerPolicy

      protected InterfaceContainerPolicy(Class<?> containerClass)
      INTERNAL: Construct a new policy for the specified class.
    • InterfaceContainerPolicy

      protected InterfaceContainerPolicy(String containerClassName)
      INTERNAL: Construct a new policy for the specified class name.
  • Method Details

    • equals

      public boolean equals(Object object)
      INTERNAL: Return if the policy is equal to the other. By default if they are the same class, they are considered equal. This is used for query parse caching.
      Overrides:
      equals in class ContainerPolicy
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class ContainerPolicy
    • cloneFor

      public Object cloneFor(Object container)
      INTERNAL: Return a clone of the specified container.
      Overrides:
      cloneFor in class ContainerPolicy
    • convertClassNamesToClasses

      public void convertClassNamesToClasses(ClassLoader classLoader)
      INTERNAL: Convert all the class-name-based settings in this ContainerPolicy to actual class-based settings. This method is used when converting a project that has been built with class names to a project with classes.
      Overrides:
      convertClassNamesToClasses in class ContainerPolicy
    • createChangeEvent

      public CollectionChangeEvent createChangeEvent(Object collectionOwner, String propertyName, Object collectionChanged, Object elementChanged, int changeType, Integer index, boolean isChangeApplied)
      INTERNAL: Creates a CollectionChangeEvent for the container
      Specified by:
      createChangeEvent in class ContainerPolicy
    • createQueryKeyForMapKey

      public QueryKey createQueryKeyForMapKey()
      INTERNAL: Create a query key that links to the map key InterfaceContainerPolicy does not support maps, so this method will return null subclasses will extend this method.
    • getCloneMethod

      public Method getCloneMethod()
      INTERNAL: Return the 'clone()' Method for the container class. Lazy initialization is used, so we can serialize these things.
    • getCloneMethod

      protected Method getCloneMethod(Class<?> javaClass)
      INTERNAL: Return the 'clone()' Method for the specified class. Return null if the method does not exist anywhere in the hierarchy
    • getContainerClass

      public Class<?> getContainerClass()
      INTERNAL: Returns the container class to be used with this policy.
      Overrides:
      getContainerClass in class ContainerPolicy
    • getContainerClassName

      public String getContainerClassName()
      Description copied from class: ContainerPolicy
      INTERNAL: Used by the MW
      Overrides:
      getContainerClassName in class ContainerPolicy
    • getDirectKeyField

      public DatabaseField getDirectKeyField(CollectionMapping mapping)
      INTERNAL: Return the DatabaseField that represents the key in a DirectMapMapping. If the keyMapping is not a DirectMapping, this will return null.
    • getInterfaceType

      public abstract Class<?> getInterfaceType()
    • hasNext

      public boolean hasNext(Object iterator)
      INTERNAL: Return whether the iterator has more objects,
      Specified by:
      hasNext in interface CoreContainerPolicy<AbstractSession>
      Specified by:
      hasNext in class ContainerPolicy
      See Also:
    • invokeCloneMethodOn

      protected Object invokeCloneMethodOn(Method method, Object container)
      INTERNAL: Invoke the specified clone method on the container, handling the necessary exceptions.
    • isMapKeyAttribute

      public boolean isMapKeyAttribute()
      INTERNAL: Return whether a map key this container policy represents is an attribute By default this method will return false since only subclasses actually represent maps.
    • isValidContainerType

      public boolean isValidContainerType(Class<?> containerType)
      INTERNAL: Validate the container type.
      Overrides:
      isValidContainerType in class ContainerPolicy
    • next

      protected Object next(Object iterator)
      INTERNAL: Return the next object on the queue. Valid for some subclasses only.
      Specified by:
      next in class ContainerPolicy
      See Also:
    • setCloneMethod

      public void setCloneMethod(Method cloneMethod)
      INTERNAL: Set the Method that will return a clone of an instance of the containerClass.
    • setContainerClass

      public void setContainerClass(Class<?> containerClass)
      INTERNAL: Set the class to use as the container.
      Specified by:
      setContainerClass in interface CoreContainerPolicy<AbstractSession>
      Overrides:
      setContainerClass in class ContainerPolicy
    • setContainerClassName

      public void setContainerClassName(String containerClassName)
      Description copied from class: ContainerPolicy
      INTERNAL: Used by the MW
      Overrides:
      setContainerClassName in class ContainerPolicy
    • buildContainerFromVector

      public Object buildContainerFromVector(Vector vector, AbstractSession session)
      INTERNAL: Return a container populated with the contents of the specified Vector.
      Overrides:
      buildContainerFromVector in class ContainerPolicy
    • toStringInfo

      protected Object toStringInfo()
      Overrides:
      toStringInfo in class ContainerPolicy