Top Description Fields Constructors Methods
org.wildfly.common.ref

public Class SoftReference<T, A>

extends SoftReference<T>
implements Reference<T, A>, Reapable<T, A>
Class Inheritance
All Implemented Interfaces
org.wildfly.common.ref.Reapable, org.wildfly.common.ref.Reference
Type Parameters
<T>
the reference value type
<A>
the attachment type
Imports
java.lang.ref.ReferenceQueue

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
java.lang.ref.SoftReference

Field Summary

Modifier and TypeField and Description
private final A
private final Reaper<T, A>

Constructor Summary

AccessConstructor and Description
public
SoftReference(final T
the referent
referent
)

Construct a new instance.

public
SoftReference(final T
the referent
referent
,
final A
the attachment
attachment
)

Construct a new instance.

public
SoftReference(final T
the referent
referent
,
final A
the attachment
attachment
,
final ReferenceQueue<? super T>
the reference queue to use
q
)

Construct a new instance with an explicit reference queue.

public
SoftReference(final T
the referent
referent
,
final A
the attachment
attachment
,
final Reaper<T, A>
the reaper to use
reaper
)

Construct a new instance with a reaper.

Method Summary

Modifier and TypeMethod and Description
public A
getAttachment()

Implements org.wildfly.common.ref.Reference.getAttachment.

Get the attachment, if any.
public Reaper<T, A>
getReaper()

Implements org.wildfly.common.ref.Reapable.getReaper.

Get the associated reaper.
public Reference.Type
getType()

Implements org.wildfly.common.ref.Reference.getType.

Get the type of the reference.
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.ref.SoftReference:
get

Field Detail

attachmentback to summary
private final A attachment
reaperback to summary
private final Reaper<T, A> reaper

Constructor Detail

SoftReferenceback to summary
public SoftReference(final T referent)

Construct a new instance.

Parameters
referent:T

the referent

SoftReferenceback to summary
public SoftReference(final T referent, final A attachment)

Construct a new instance.

Parameters
referent:T

the referent

attachment:A

the attachment

SoftReferenceback to summary
public SoftReference(final T referent, final A attachment, final ReferenceQueue<? super T> q)

Construct a new instance with an explicit reference queue.

Parameters
referent:T

the referent

attachment:A

the attachment

q:ReferenceQueue<? super T>

the reference queue to use

SoftReferenceback to summary
public SoftReference(final T referent, final A attachment, final Reaper<T, A> reaper)

Construct a new instance with a reaper.

Parameters
referent:T

the referent

attachment:A

the attachment

reaper:Reaper<T, A>

the reaper to use

Method Detail

getAttachmentback to summary
public A getAttachment()

Implements org.wildfly.common.ref.Reference.getAttachment.

Doc from org.wildfly.common.ref.Reference.getAttachment.

Get the attachment, if any.

Returns:A

the attachment

getReaperback to summary
public Reaper<T, A> getReaper()

Implements org.wildfly.common.ref.Reapable.getReaper.

Doc from org.wildfly.common.ref.Reapable.getReaper.

Get the associated reaper.

Returns:Reaper<T, A>

the reaper

getTypeback to summary
public Reference.Type getType()

Implements org.wildfly.common.ref.Reference.getType.

Doc from org.wildfly.common.ref.Reference.getType.

Get the type of the reference.

Returns:Reference.Type

the type

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.