EclipseLink 2.3.2, build 'v20111125-r10461' API Reference

org.eclipse.persistence.annotations
Enum CacheType

java.lang.Object
  extended by java.lang.Enum<CacheType>
      extended by org.eclipse.persistence.annotations.CacheType
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<CacheType>

public enum CacheType
extends java.lang.Enum<CacheType>

The CacheType enum is used with the Cache annotation for a persistent class. It defines the type of IdentityMap/Cache used for the class. By default the SOFT_WEAK cache type is used.

See Also:
Cache
Author:
Guy Pelletier
Since:
Oracle TopLink 11.1.1.0.0

Enum Constant Summary
CACHE
          A cache identity map maintains a fixed number of objects specified by the application.
FULL
          Provides full caching and guaranteed identity.
HARD_WEAK
          Identical to the soft cache weak (SOFT_WEAK) identity map except that it uses hard references in the sub-cache.
NONE
          WARNING: Does not preserve object identity and does not cache objects.
SOFT
          Similar to the FULL identity map except that the map holds the objects using soft references.
SOFT_WEAK
          Similar to the WEAK identity map except that it maintains a most-frequently-used sub-cache.
WEAK
          Similar to the FULL identity map except that the map holds the objects using weak references.
 
Method Summary
static CacheType valueOf(java.lang.String name)
          Returns the enum constant of this type with the specified name.
static CacheType[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

FULL

public static final CacheType FULL
Provides full caching and guaranteed identity. Caches all objects and does not remove them. WARNING: This method may be memory intensive when many objects are read.


WEAK

public static final CacheType WEAK
Similar to the FULL identity map except that the map holds the objects using weak references. This method allows full garbage collection and provides full caching and guaranteed identity.


SOFT

public static final CacheType SOFT
Similar to the FULL identity map except that the map holds the objects using soft references. This method allows full garbage collection when memory is low and provides full caching and guaranteed identity.


SOFT_WEAK

public static final CacheType SOFT_WEAK
Similar to the WEAK identity map except that it maintains a most-frequently-used sub-cache. The size of the sub-cache is proportional to the size of the identity map as specified by descriptor's setIdentityMapSize() method. The sub-cache uses soft references to ensure that these objects are garbage-collected only if the system is low on memory.


HARD_WEAK

public static final CacheType HARD_WEAK
Identical to the soft cache weak (SOFT_WEAK) identity map except that it uses hard references in the sub-cache. Use this identity map if soft references do not behave properly on your platform.


CACHE

public static final CacheType CACHE
A cache identity map maintains a fixed number of objects specified by the application. Objects are removed from the cache on a least-recently-used basis. This method allows object identity for the most commonly used objects. WARNING: Furnishes caching and identity, but does not guarantee identity.


NONE

public static final CacheType NONE
WARNING: Does not preserve object identity and does not cache objects.

Method Detail

values

public static CacheType[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (CacheType c : CacheType.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static CacheType valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
java.lang.NullPointerException - if the argument is null

EclipseLink 2.3.2, build 'v20111125-r10461' API Reference