org.apache.jcs.engine
Class CacheElement<K extends Serializable,V extends Serializable>

java.lang.Object
  extended by org.apache.jcs.engine.CacheElement<K,V>
All Implemented Interfaces:
Serializable, ICacheElement<K,V>

public class CacheElement<K extends Serializable,V extends Serializable>
extends Object
implements ICacheElement<K,V>, Serializable

Generic element wrapper. Often stuffed inside another.

See Also:
Serialized Form

Field Summary
 IElementAttributes attr
          These attributes hold information about the element and what it is allowed to do.
 String cacheName
          The name of the cache region.
 K key
          This is the cache key by which the value can be referenced.
 V val
          This is the cached value, reference by the key.
 
Constructor Summary
CacheElement(String cacheName, K key, V val)
          Constructor for the CacheElement object
CacheElement(String cacheName, K key, V val, IElementAttributes attrArg)
          Constructor for the CacheElement object
 
Method Summary
 String getCacheName()
          Gets the cacheName attribute of the CacheElement object
 IElementAttributes getElementAttributes()
          Gets the IElementAttributes attribute of the CacheElement object
 K getKey()
          Gets the key attribute of the CacheElement object
 V getVal()
          Gets the val attribute of the CacheElement object
 int hashCode()
           
 void setElementAttributes(IElementAttributes attr)
          Sets the attributes attribute of the CacheElement object
 String toString()
          For debugging only.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

cacheName

public final String cacheName
The name of the cache region. This is a namespace.


key

public final K extends Serializable key
This is the cache key by which the value can be referenced.


val

public final V extends Serializable val
This is the cached value, reference by the key.


attr

public IElementAttributes attr
These attributes hold information about the element and what it is allowed to do.

Constructor Detail

CacheElement

public CacheElement(String cacheName,
                    K key,
                    V val)
Constructor for the CacheElement object

Parameters:
cacheName -
key -
val -

CacheElement

public CacheElement(String cacheName,
                    K key,
                    V val,
                    IElementAttributes attrArg)
Constructor for the CacheElement object

Parameters:
cacheName -
key -
val -
attrArg -
Method Detail

getCacheName

public String getCacheName()
Gets the cacheName attribute of the CacheElement object

Specified by:
getCacheName in interface ICacheElement<K extends Serializable,V extends Serializable>
Returns:
The cacheName value

getKey

public K getKey()
Gets the key attribute of the CacheElement object

Specified by:
getKey in interface ICacheElement<K extends Serializable,V extends Serializable>
Returns:
The key value

getVal

public V getVal()
Gets the val attribute of the CacheElement object

Specified by:
getVal in interface ICacheElement<K extends Serializable,V extends Serializable>
Returns:
The val value

setElementAttributes

public void setElementAttributes(IElementAttributes attr)
Sets the attributes attribute of the CacheElement object

Specified by:
setElementAttributes in interface ICacheElement<K extends Serializable,V extends Serializable>
Parameters:
attr - The new IElementAttributes value

getElementAttributes

public IElementAttributes getElementAttributes()
Gets the IElementAttributes attribute of the CacheElement object

Specified by:
getElementAttributes in interface ICacheElement<K extends Serializable,V extends Serializable>
Returns:
The IElementAttributes value, never null

hashCode

public int hashCode()
Overrides:
hashCode in class Object
Returns:
a hash of the key only

toString

public String toString()
For debugging only.

Overrides:
toString in class Object
Returns:
String representation


Copyright © 2002-2013 The Apache Software Foundation. All Rights Reserved.