V - The type that may be assigned (or not).public interface Assignment<V> extends Supplier<V>, Consumer<V>, ViewableAsOptional.Single<V>
Supplier.get()
and will return null if unassigned, and may be assigned with set(Object) if the
assignment allows (re-)assignment.ViewableAsOptional.Single<V>, ViewableAsOptional.TooManyElements| Modifier and Type | Method and Description |
|---|---|
default void |
accept(V value) |
default <C> ChainableAssignment<V,C> |
chainableWith(C chainReturnObject)
Create a
ChainableAssignment from this assignment. |
static <V> Assignment<V> |
from(AtomicReference<V> reference)
Create a new
Assignment which uses an AtomicReference
to hold the assigned value. |
static <V,S> Assignment<V> |
from(S container,
Function<? super S,V> getter,
BiConsumer<? super S,? super V> setter)
Create a new
Assignment, which assigns to and retrieves from an arbitrary container object. |
void |
set(V value)
Assign the given value.
|
toOptionalstatic <V> Assignment<V> from(AtomicReference<V> reference)
Assignment which uses an AtomicReference
to hold the assigned value.reference - the holder of the assigned valueAssignment using the given AtomicReference.static <V,S> Assignment<V> from(S container, Function<? super S,V> getter, BiConsumer<? super S,? super V> setter)
Assignment, which assigns to and retrieves from an arbitrary container object.container - The holder of the assigned value.getter - how the get the value from the containersetter - how to set the value on the containerAssignment.void set(V value)
value - the value to assign.default <C> ChainableAssignment<V,C> chainableWith(C chainReturnObject)
ChainableAssignment from this assignment.ChainableAssignmentCopyright © 2018 Digipost. All rights reserved.