com.h3c.util.cache

## Class CachedValueWeakReference<K,V>

- java.lang.Object
- - java.lang.ref.Reference<T>
  - - java.lang.ref.WeakReference<V>
    - - com.h3c.util.cache.CachedValueWeakReference<K,V>

- Type Parameters:
    `K` - the type of keys maintained by the cache that holds these value references
    `V` - the type of cached values

      public final class CachedValueWeakReference<K,V>
      extends WeakReference<V>

  This class extends WeakReference to allow us to encapsulate the cache that contains this reference, and the key with which it is associated.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `CachedValueWeakReference(WeakValueCache<K,V> cache, K key, V referent, ReferenceQueue<? super V> q)` Constructs a new cached value weak reference that refers to the given object and is registered with the given queue.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `toString()`

    - ### 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, wait, wait, wait`

- - ### Constructor Detail

    - #### CachedValueWeakReference

          public CachedValueWeakReference(WeakValueCache<K,V> cache,
                                  K key,
                                  V referent,
                                  ReferenceQueue<? super V> q)

      Constructs a new cached value weak reference that refers to the given object and is registered with the given queue.
      Parameters:
        `cache` - the cache that holds this reference
        `key` - the key associated with the reference
        `referent` - the object to which the new weak reference will refer
        `q` - the queue with which the reference is to be registered
      Throws:
        `NullPointerException` - if any parameter is null

  - ### Method Detail

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

Copyright © 2014. All Rights Reserved.