org.jboss.modules.ref
Class SoftReference<T,A>

java.lang.Object
  extended by java.lang.ref.Reference<T>
      extended by java.lang.ref.SoftReference<T>
          extended by org.jboss.modules.ref.SoftReference<T,A>
Type Parameters:
T - the reference value type
A - the attachment type
All Implemented Interfaces:
Reference<T,A>

public class SoftReference<T,A>
extends SoftReference<T>
implements Reference<T,A>

A reapable soft reference with an attachment. If a Reaper is given, then it will be used to asynchronously clean up the referent.

Author:
David M. Lloyd
See Also:
SoftReference

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.jboss.modules.ref.Reference
Reference.Type
 
Constructor Summary
SoftReference(T referent)
           
SoftReference(T referent, A attachment)
           
SoftReference(T referent, A attachment, Reaper<T,A> reaper)
           
SoftReference(T referent, A attachment, ReferenceQueue<? super T> q)
           
 
Method Summary
 A getAttachment()
          Get the attachment, if any.
 Reaper<T,A> getReaper()
          Get the associated reaper.
 Reference.Type getType()
          Get the type of the reference.
 String toString()
           
 
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, wait, wait, wait
 
Methods inherited from interface org.jboss.modules.ref.Reference
clear, get
 

Constructor Detail

SoftReference

public SoftReference(T referent)

SoftReference

public SoftReference(T referent,
                     A attachment)

SoftReference

public SoftReference(T referent,
                     A attachment,
                     ReferenceQueue<? super T> q)

SoftReference

public SoftReference(T referent,
                     A attachment,
                     Reaper<T,A> reaper)
Method Detail

getReaper

public Reaper<T,A> getReaper()
Get the associated reaper.

Returns:
the reaper

getAttachment

public A getAttachment()
Description copied from interface: Reference
Get the attachment, if any.

Specified by:
getAttachment in interface Reference<T,A>
Returns:
the attachment

getType

public Reference.Type getType()
Description copied from interface: Reference
Get the type of the reference.

Specified by:
getType in interface Reference<T,A>
Returns:
the type

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2011. All Rights Reserved.