public interface KeyedVisitable<K,E>
This interface allows visiting any element of a keyed collection of resources
The default implementations are trivial, however further guarantees can be provided. e.g. a remote client may have the code executed on the server atomically.
Modifier and Type | Method and Description |
---|---|
default <T,R> R |
applyToKey(K key,
@NotNull net.openhft.chronicle.core.util.SerializableBiFunction<E,T,R> function,
T argument)
Apply a function which takes an argument.
|
default <R> R |
applyToKey(K key,
@NotNull net.openhft.chronicle.core.util.SerializableFunction<E,R> function)
Apply a function to the visitable and return the result.
|
default <T> void |
asyncUpdateKey(K key,
@NotNull net.openhft.chronicle.core.util.SerializableBiFunction<E,T,E> updateFunction,
T argument)
Apply a function to visitable potentially asynchronously.
|
default void |
asyncUpdateKey(K key,
@NotNull net.openhft.chronicle.core.util.SerializableFunction<E,E> updateFunction)
Apply a function to visitable potentially asynchronously.
|
E |
get(K key) |
void |
set(K key,
E element) |
default <T,A,R> R |
syncUpdateKey(K key,
@NotNull net.openhft.chronicle.core.util.SerializableBiFunction<E,T,E> updateFunction,
T updateArgument,
@NotNull net.openhft.chronicle.core.util.SerializableBiFunction<E,A,R> returnFunction,
A returnArgument)
Apply a function to update the state of a visible, and apply a function to return a result object synchronously.
|
default <R> R |
syncUpdateKey(K key,
@NotNull net.openhft.chronicle.core.util.SerializableFunction<E,E> updateFunction,
@NotNull net.openhft.chronicle.core.util.SerializableFunction<E,R> returnFunction)
Apply a function to update the state of a visible, and apply a function to return a result object synchronously.
|
@Nullable E get(K key)
key
- to get within this collection.void set(K key, E element)
key
- to set within this collection.element
- replace the current state of the visitable Asset@Nullable default <R> R applyToKey(K key, @NotNull @NotNull net.openhft.chronicle.core.util.SerializableFunction<E,R> function)
R
- data type to return.key
- to visit within this collection.function
- to apply e.g. call a getterdefault void asyncUpdateKey(K key, @NotNull @NotNull net.openhft.chronicle.core.util.SerializableFunction<E,E> updateFunction)
key
- to visit within this collection.updateFunction
- to update the state of the visibility.@Nullable default <R> R syncUpdateKey(K key, @NotNull @NotNull net.openhft.chronicle.core.util.SerializableFunction<E,E> updateFunction, @NotNull @NotNull net.openhft.chronicle.core.util.SerializableFunction<E,R> returnFunction)
R
- data type to return.key
- to update within this collection.updateFunction
- update to apply to the value.returnFunction
- derive an object to return@Nullable default <T,R> R applyToKey(K key, @NotNull @NotNull net.openhft.chronicle.core.util.SerializableBiFunction<E,T,R> function, T argument)
T
- type of the argumentR
- type of the return value.key
- to visit within this collection.function
- to applyargument
- for the functions use.default <T> void asyncUpdateKey(K key, @NotNull @NotNull net.openhft.chronicle.core.util.SerializableBiFunction<E,T,E> updateFunction, T argument)
T
- type of the argumentkey
- to update within this collectionupdateFunction
- to update the state of the visitable.argument
- for the functions use.@Nullable default <T,A,R> R syncUpdateKey(K key, @NotNull @NotNull net.openhft.chronicle.core.util.SerializableBiFunction<E,T,E> updateFunction, @Nullable T updateArgument, @NotNull @NotNull net.openhft.chronicle.core.util.SerializableBiFunction<E,A,R> returnFunction, @Nullable A returnArgument)
T
- update argument type.A
- return argument type.R
- data type to return.key
- to update within this collectionupdateFunction
- update to apply to the value.updateArgument
- for the update function to use.returnFunction
- derive an object to returnreturnArgument
- for the return value function to useCopyright © 2021. All rights reserved.