@Deprecated public abstract class Reference<L> extends Object
ReferenceLifecycle
subclass. Use acquire(ComponentContext, Reference)
to acquire the underlying resource and
release(ComponentContext, Object, Reference)
to release it when
it's not needed anymore.Modifier and Type | Class and Description |
---|---|
static class |
Reference.Builder<L>
Deprecated.
|
Modifier | Constructor and Description |
---|---|
protected |
Reference(ReferenceLifecycle<L> lifecycle)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
static <T> T |
acquire(ComponentContext context,
Reference<T> reference)
Deprecated.
Acquires a Reference of type T.
|
abstract String |
getSimpleName()
Deprecated.
|
static <T> void |
release(ComponentContext context,
T value,
Reference<T> reference)
Deprecated.
Releases the object previously acquired by calling
acquire(ComponentContext, Reference) . |
static <T> boolean |
shouldUpdate(Reference<T> previous,
Reference<T> next)
Deprecated.
Checks whether acquiring object from two references will produce the same result.
|
protected Reference(ReferenceLifecycle<L> lifecycle)
public static <T> T acquire(ComponentContext context, Reference<T> reference)
release(ComponentContext, Object, Reference)
.
Calling acquire twice with the same reference does not guarantee that the same instance will
be returned twice.public static <T> void release(ComponentContext context, T value, Reference<T> reference)
acquire(ComponentContext, Reference)
.
An object that was released calling this function should not be retained or used in any way.public abstract String getSimpleName()
public static <T> boolean shouldUpdate(Reference<T> previous, Reference<T> next)
Object.equals(Object)
. When defining a custom
reference it's possible to provide custom logic for the comparison implementing a method
annotated with the ShouldUpdate
annotation.