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

java.lang.Object
  extended by java.lang.ref.Reference<T>
      extended by java.lang.ref.WeakReference<V>
          extended by net.sourceforge.rcache.WeakKeyedReference<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 WeakKeyedReference<K,V>
extends java.lang.ref.WeakReference<V>
implements KeyedReference<K,V>

KeyedReference implementation based on WeakReference.

Author:
Rodrigo Ruiz

Constructor Summary
WeakKeyedReference(K key, V value, java.lang.ref.ReferenceQueue<V> rq)
          WeakKeyedReference constructor.
 
Method Summary
 K getKey()
          Get the reference key.
 
Methods inherited from class java.lang.ref.Reference
clear, enqueue, get, 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

WeakKeyedReference

public WeakKeyedReference(K key,
                          V value,
                          java.lang.ref.ReferenceQueue<V> rq)
WeakKeyedReference 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