Top Description Fields Constructors Methods
io.smallrye.common.ref

public Class StrongReference<T, A>

extends Object
implements Reference<T, A>
Class Inheritance
All Implemented Interfaces
io.smallrye.common.ref.Reference
Type Parameters
<T>
the reference value type
<A>
the attachment type

A strong reference with an attachment. Since strong references are always reachable, a reaper may not be used.

Field Summary

Modifier and TypeField and Description
private final A
private volatile T

Constructor Summary

AccessConstructor and Description
public
StrongReference(final T
the referent
referent
,
final A
the attachment
attachment
)

Construct a new instance.

public
StrongReference(final T
the referent
referent
)

Construct a new instance.

Method Summary

Modifier and TypeMethod and Description
public void
clear()

Implements io.smallrye.common.ref.Reference.clear.

Clear the reference.

public T
get()

Implements io.smallrye.common.ref.Reference.get.

Get the value, or null if the reference has been cleared.

public A
getAttachment()

Implements io.smallrye.common.ref.Reference.getAttachment.

Get the attachment, if any.

public Reference.Type
getType()

Implements io.smallrye.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.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

attachmentback to summary
private final A attachment
referentback to summary
private volatile T referent

Constructor Detail

StrongReferenceback to summary
public StrongReference(final T referent, final A attachment)

Construct a new instance.

Parameters
referent:T

the referent

attachment:A

the attachment

StrongReferenceback to summary
public StrongReference(final T referent)

Construct a new instance.

Parameters
referent:T

the referent

Method Detail

clearback to summary
public void clear()

Implements io.smallrye.common.ref.Reference.clear.

Doc from io.smallrye.common.ref.Reference.clear.

Clear the reference.

getback to summary
public T get()

Implements io.smallrye.common.ref.Reference.get.

Doc from io.smallrye.common.ref.Reference.get.

Get the value, or null if the reference has been cleared.

Returns:T

the value

getAttachmentback to summary
public A getAttachment()

Implements io.smallrye.common.ref.Reference.getAttachment.

Doc from io.smallrye.common.ref.Reference.getAttachment.

Get the attachment, if any.

Returns:A

the attachment

getTypeback to summary
public Reference.Type getType()

Implements io.smallrye.common.ref.Reference.getType.

Doc from io.smallrye.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. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object