public final class Refs
extends java.lang.Object
reference
factory & utility methods.Modifier and Type | Class and Description |
---|---|
private static class |
Refs.DefaultRefImpl<T>
Default (mutable)
Ref implementation. |
private static class |
Refs.ImmutableRefImpl<T>
Immutable
Ref implementation. |
private static class |
Refs.ThreadSafeRefImpl<T>
Thread-safe
Ref implementation. |
Modifier | Constructor and Description |
---|---|
private |
Refs() |
Modifier and Type | Method and Description |
---|---|
static <T> Ref<T> |
emptyRef()
Construct a new empty mutable
Ref instance. |
static <T> Ref<T> |
immutableRef(T value)
Construct a new immutable
Ref instance referencing the given
input value. |
static <T> Ref<T> |
of(T value)
Construct a new mutable
Ref instance referencing the given
input value. |
static <T> Ref<T> |
threadSafe()
Construct a new empty mutable thread-safe
Ref instance. |
static <T> Ref<T> |
threadSafe(T value)
Construct a new mutable thread-safe
Ref instance referencing the given
input value. |
public static <T> Ref<T> of(T value)
Ref
instance referencing the given
input value.T
- type of the referenced instance.value
- value of the newly constructed reference.Ref
instance referencing the given
input value.public static <T> Ref<T> emptyRef()
Ref
instance.T
- type of the referenced instance.Ref
instance.public static <T> Ref<T> threadSafe()
Ref
instance.T
- type of the referenced instance.Ref
instance.public static <T> Ref<T> threadSafe(T value)
Ref
instance referencing the given
input value.T
- type of the referenced instance.value
- value of the newly constructed reference.Ref
instance referencing the given
input value.public static <T> Ref<T> immutableRef(T value)
Ref
instance referencing the given
input value.
Invoking a Settable.set(java.lang.Object)
on the returned instance
will result in a IllegalStateException
being thrown.T
- type of the referenced instance.value
- value of the newly constructed reference.Ref
instance referencing the given
input value.