kiss
Variable<V>
V>A re-assignable container object which may or may not contain a non-null value. If a value is
present, #isPresent() returns true. If no value is present, the object is considered
empty and #isPresent() returns false. Unlike Optional, this container is
re-assignable.
Additional methods that depend on the presence or absence of a contained value are provided, such
as #or(Object) (returns a default value if no value is present) and #to(Consumer)
(performs an action if a value is present).
vV
The current value. This value is not final but read-only.
Variable(Vvalue)
Vvalue)Vvalue |
Hide constructor.
accept(Vvalue)void
Vvalue)Vvalue |
acquire()V
V |
Current value or next value. |
Get the current value. If there is no value, wait until the value is set.
exact()V
V |
Current value or throws error. |
Get the current value. If there is no value, NullPointerException will be thrown.
get()V
V |
Current value or null. |
Get the current value. If there is no value, returns null.
intercept(WiseBiFunctionV, V, Vinterceptor)VariableV
WiseBiFunctionV, V, Vinterceptor)VWiseBiFunctioninterceptor |
An interceptor for value modification. First parameter is the current value, Second parameter is the new value. |
Variable |
Chainable API. |
Intercept the value modification.
is(Vvalue)boolean
Vvalue)Vvalue |
A value to check the equality. |
boolean |
A result of equality. |
Test whether the current value is equal to the specified value or not.
is(PredicateVcondition)boolean
PredicateVcondition)Predicatecondition |
A value validator. |
boolean |
A result of validation. |
Test whether the current value fulfills the specified condition or not.
isNot(Vvalue)boolean
Vvalue)Vvalue |
A value to check the equality. |
boolean |
A result of equality. |
Test whether the current value is NOT equal to the specified value or not.
isNot(PredicateVcondition)boolean
PredicateVcondition)Predicatecondition |
A value validator. |
boolean |
A result of validation. |
Test whether the current value does NOT fulfill the specified condition or not.
isAbsent()boolean
boolean |
A result. |
Check whether the value is absent or not.
isPresent()boolean
boolean |
A result. |
Check whether the value is present or not.
isFixed()boolean
boolean |
A result. |
Check whether the value is fixed or not.
fix()VariableV
VVariable |
Chainable API. |
Fix this value as immutable.
flip(Supplier?Rthen)VariableR
Supplier?Rthen)RR |
|
Supplierthen |
An action to perform. |
Variable |
The computed |
Perform the specified action if the value is absent.
flatFlip(SupplierVariableRmapper)VariableR
SupplierVariableRmapper)RR |
|
Suppliermapper |
The mapping function to apply to a value, if present. |
Variable |
The computed |
If a value is present, returns the result of applying the given Variable-bearing
mapping function to the value, otherwise returns an empty Variable.
map(Function?V, ?Rthen)VariableR
Function?V, ?Rthen)RR |
|
Functionthen |
An action to perform. |
Variable |
The computed |
Perform the specified action if the value is present.
flatMap(FunctionV, VariableRmapper)VariableR
FunctionV, VariableRmapper)RR |
|
Functionmapper |
The mapping function to apply to a value, if present. |
Variable |
The computed |
If a value is present, returns the result of applying the given Variable-bearing
mapping function to the value, otherwise returns an empty Variable.
next()V
V |
The next value. |
Get the value to be set next. The method waits until a new value is set.
observe()SignalV
VSignal |
The |
Observe this Variable.
observing()SignalV
VSignal |
The |
Observe this Variable with the current value.
or(Vother)V
Vother)Vother |
A value to be returned if there is no value present, may be null. |
V |
The current value or alternative value. |
Get the current value. If there is no value, returns the specified alternative value.
or(SupplierVother)V
SupplierVother)Supplierother |
A value to be returned if there is no value present, may be null. |
V |
The current value or alternative value. |
Get the current value. If there is no value, returns the specified alternative value.
set(Vvalue)V
Vvalue)Vvalue |
A value to assign. |
V |
A previous value. |
Assign the new value.
set(SupplierVvalue)V
SupplierVvalue)Suppliervalue |
A value generator. |
V |
A previous value. |
Assign the new value.
set(UnaryOperatorVvalue)V
UnaryOperatorVvalue)UnaryOperatorvalue |
A value generator. |
V |
A previous value. |
Assign the new value.
to(ConsumerVsome)void
ConsumerVsome)Consumersome |
A user action. |
Execute the specified action if the value is present.
to(ConsumerVsome, Runnablenone)void
ConsumerVsome, Runnablenone)Consumersome |
A user action. |
Runnablenone |
Execute the specified action.
hashCode()int
int |
equals(Objectobj)boolean
Objectobj)Objectobj |
|
boolean |
toString()String
String |
of(Tvalue)VariableT
Tvalue)TT |
|
Tvalue |
An actual value, |
Variable |
A created |
Create Variable with the specified value.
empty()VariableT
TT |
|
Variable |
A new empty |
Create empty Variable.