Interface Channel<T>
- Type Parameters:
T
- the type of the state property
- All Known Implementing Classes:
AppenderChannel
A Channel is associated with a key and a value. The Channel is updated
by calling the update(String, Object, Object)
method. The update
operation is applied to the channel's value.
The Channel may be initialized with a default value. This default value
is provided by a Supplier
. The getDefault()
method returns
an optional containing the default supplier.
The Channel may also be associated with a Reducer. The Reducer is a function that combines the current value of the channel with a new value and returns the updated value.
The update(String, Object, Object)
method updates the channel's
value with the provided key, old value and new value. The update operation
is applied to the channel's value. If the channel is not initialized, the
default value is used. If the channel is initialized, the reducer is used
to compute the new value.
-
Method Summary
Modifier and TypeMethodDescriptiona Supplier that provide a default value.The Reducer, if provided, is invoked for each state property to compute value.static <T> Channel<T>
static <T> Channel<T>
static <T> Channel<T>
default Object
Update the state property with the given key and returns the new value.
-
Method Details
-
of
-
of
-
of
-
getReducer
The Reducer, if provided, is invoked for each state property to compute value.- Returns:
- An optional containing the reducer, if it exists.
-
getDefault
a Supplier that provide a default value. The result must be mutable.- Returns:
- an Optional containing the default Supplier
-
update
Update the state property with the given key and returns the new value.- Parameters:
key
- the key of the state property to be updatedoldValue
- the current value of the state propertynewValue
- the new value to be set- Returns:
- the new value of the state property
-