net.sourceforge.rcache
Class SoftKeyedReference<K,V>

java.lang.Object
  extended by java.lang.ref.Reference<T>
      extended by java.lang.ref.SoftReference<V>
          extended by net.sourceforge.rcache.SoftKeyedReference<K,V>
Type Parameters:
K - the type of keys maintained by this cache
V - the type of cached values
All Implemented Interfaces:
KeyedReference<K,V>

public final class SoftKeyedReference<K,V>
extends java.lang.ref.SoftReference<V>
implements KeyedReference<K,V>

KeyedReference implementation based on SoftReference.

Author:
Rodrigo Ruiz

Constructor Summary
SoftKeyedReference(K key, V value, java.lang.ref.ReferenceQueue<V> rq)
          SoftKeyedReference constructor.
 
Method Summary
 K getKey()
          Get the reference key.
 
Methods inherited from class java.lang.ref.SoftReference
get
 
Methods inherited from class java.lang.ref.Reference
clear, enqueue, isEnqueued
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sourceforge.rcache.KeyedReference
get
 

Constructor Detail

SoftKeyedReference

public SoftKeyedReference(K key,
                          V value,
                          java.lang.ref.ReferenceQueue<V> rq)
SoftKeyedReference constructor.

Parameters:
key - the key
value - the object to cache
rq - a reference queue
Method Detail

getKey

public K getKey()
Get the reference key.

Specified by:
getKey in interface KeyedReference<K,V>
Returns:
The key


© 2007-2009 Rodrigo Ruiz
This site is hosted by