com.evanmclean.evlib.cache
Enum CacheReferenceType

java.lang.Object
  extended by java.lang.Enum<CacheReferenceType>
      extended by com.evanmclean.evlib.cache.CacheReferenceType
All Implemented Interfaces:
Serializable, Comparable<CacheReferenceType>

public enum CacheReferenceType
extends Enum<CacheReferenceType>

Indicates how values in a ConcurrentHashMapCache are referenced.

Author:
Evan McLean McLean Computer Services (see the overview for copyright and licensing.)

Enum Constant Summary
SOFT
          Value is wrapped with a SoftReference.
STRONG
          Value is kept in the cache until it expires or is explicitly removed.
WEAK
          Value is wrapped with a WeakReference.
 
Method Summary
static CacheReferenceType valueOf(String name)
          Returns the enum constant of this type with the specified name.
static CacheReferenceType[] 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

STRONG

public static final CacheReferenceType STRONG
Value is kept in the cache until it expires or is explicitly removed.


SOFT

public static final CacheReferenceType SOFT
Value is wrapped with a SoftReference. If you want caches that will drop values when memory gets tight, this is probably the one you want.


WEAK

public static final CacheReferenceType WEAK
Value is wrapped with a WeakReference.

Method Detail

values

public static CacheReferenceType[] 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 (CacheReferenceType c : CacheReferenceType.values())
    System.out.println(c);

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

valueOf

public static CacheReferenceType valueOf(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:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null