public interface StateAccess<Context extends IFContext,ItemBuilder extends ItemComponentBuilder<ItemBuilder,Context> & ComponentFactory>
| Modifier and Type | Method and Description |
|---|---|
<T> PaginationStateBuilder<Context,ItemBuilder,T> |
buildComputedAsyncPaginationState(@NotNull java.util.function.Function<Context,java.util.concurrent.CompletableFuture<java.util.List<T>>> sourceProvider)
Creates a new unmodifiable computed pagination state builder with asynchronous data source.
|
<T> PaginationStateBuilder<Context,ItemBuilder,T> |
buildComputedPaginationState(@NotNull java.util.function.Function<Context,java.util.List<? super T>> sourceProvider)
Creates a new unmodifiable dynamic pagination state builder.
|
<T> PaginationStateBuilder<Context,ItemBuilder,T> |
buildLazyAsyncPaginationState(@NotNull java.util.function.Function<Context,java.util.concurrent.CompletableFuture<java.util.List<T>>> sourceProvider)
Creates a new unmodifiable lazy pagination state builder with asynchronous data source.
|
<T> PaginationStateBuilder<Context,ItemBuilder,T> |
buildLazyPaginationState(@NotNull java.util.function.Function<Context,java.util.List<? super T>> sourceProvider)
Creates a new unmodifiable lazy pagination state builder.
|
<T> PaginationStateBuilder<Context,ItemBuilder,T> |
buildLazyPaginationState(@NotNull java.util.function.Supplier<java.util.List<? super T>> sourceProvider)
Creates a new unmodifiable lazy pagination state builder.
|
<T> PaginationStateBuilder<Context,ItemBuilder,T> |
buildPaginationState(@NotNull java.util.List<? super T> sourceProvider)
Creates a new unmodifiable static pagination state builder.
|
<T> State<Pagination> |
computedAsyncPaginationState(@NotNull java.util.function.Function<Context,java.util.concurrent.CompletableFuture<java.util.List<T>>> sourceProvider,
@NotNull PaginationValueConsumer<Context,ItemBuilder,T> valueConsumer)
Creates a new unmodifiable computed pagination state with asynchronous data source.
|
<T> State<Pagination> |
computedPaginationState(@NotNull java.util.function.Function<Context,java.util.List<? super T>> sourceProvider,
@NotNull PaginationValueConsumer<Context,ItemBuilder,T> valueConsumer)
Creates a new unmodifiable computed pagination state.
|
<T> State<T> |
computedState(@NotNull java.util.function.Function<Context,T> computation)
Creates an immutable computed state.
|
<T> State<T> |
computedState(@NotNull java.util.function.Supplier<T> computation)
Creates an immutable computed state.
|
<T> MutableState<T> |
initialState()
Creates a mutable
lazy state whose value is always computed
from the initial data set by its StateValueHost. |
<T> MutableState<T> |
initialState(@NotNull java.lang.String key)
Creates a mutable
lazy state whose value is always computed
from the initial data set by its StateValueHost. |
<T> State<Pagination> |
lazyAsyncPaginationState(@NotNull java.util.function.Function<Context,java.util.concurrent.CompletableFuture<java.util.List<T>>> sourceProvider,
@NotNull PaginationValueConsumer<Context,ItemBuilder,T> valueConsumer)
Creates a new unmodifiable lazy pagination state with asynchronous data source.
|
<T> State<Pagination> |
lazyPaginationState(@NotNull java.util.function.Function<Context,java.util.List<? super T>> sourceProvider,
@NotNull PaginationValueConsumer<Context,ItemBuilder,T> valueConsumer)
Creates a new unmodifiable lazy pagination state.
|
<T> State<Pagination> |
lazyPaginationState(@NotNull java.util.function.Supplier<java.util.List<? super T>> sourceProvider,
@NotNull PaginationValueConsumer<Context,ItemBuilder,T> valueConsumer)
Creates a new unmodifiable lazy pagination state.
|
<T> State<T> |
lazyState(@NotNull java.util.function.Function<Context,T> computation)
Creates an immutable lazy state.
|
<T> State<T> |
lazyState(@NotNull java.util.function.Supplier<T> computation)
Creates an immutable lazy state.
|
MutableIntState |
mutableState(int initialValue)
Creates a
mutable state with an initial value. |
<T> MutableState<T> |
mutableState(T initialValue)
Creates a
mutable state with an initial value. |
<T> State<Pagination> |
paginationState(@NotNull java.util.List<? super T> sourceProvider,
@NotNull PaginationValueConsumer<Context,ItemBuilder,T> elementConsumer)
Creates a new immutable pagination with static data source.
|
<T> State<T> |
state(T initialValue)
Creates an immutable state with an initial value.
|
<T> State<T> state(T initialValue)
State<String> textState = state("test");
intState.get(...); // "test"
T - The state value type.initialValue - The initial value of the state.<T> MutableState<T> mutableState(T initialValue)
mutable state with an initial value.
MutableState<String> textState = mutableState("");
textState.get(...); // ""
textState.set("abc", ...);
textState.get(...); // "abc"
T - The state value type.initialValue - The initial value of the state.MutableIntState mutableState(int initialValue)
mutable state with an initial value.
MutableIntState intState = mutableIntState(0);
intState.get(...); // 0
intState.set(4, ...);
intState.get(...); // 4
initialValue - The initial value of the state.<T> State<T> computedState(@NotNull @NotNull java.util.function.Function<Context,T> computation)
A computed state is a state that every time an attempt is made to obtain the value of that
state, the obtained value is computed again by the computation function.
State<Integer> intState = computedState($ -> ThreadLocalRandom.current().nextInt());
intState.get(...); // some random number
intState.get(...); // another random number
T - The state value type.computation - The function to compute the value.<T> State<T> computedState(@NotNull @NotNull java.util.function.Supplier<T> computation)
A computed state is a state that every time an attempt is made to obtain the value of that
state, the obtained value is computed again by the computation function.
State<Integer> randomIntState = computedState(ThreadLocalRandom.current()::nextInt);
randomIntState.get(...); // some random number
randomIntState.get(...); // another random number
T - The state holder type.computation - The function to compute the value.<T> State<T> lazyState(@NotNull @NotNull java.util.function.Function<Context,T> computation)
factory defines what the value will be, a holder try to get the value, and the value
obtained from there will be the value that will be obtained in subsequent calls to get the
value of the state.
State<Integer> intState = lazyState($ -> ThreadLocalRandom.current().nextInt());
intState.get(...); // 54 - from initial computation of random integer ^^
intState.get(...); // 54 - previously defined by the initial computation
T - The state value type.computation - The value factory.<T> State<T> lazyState(@NotNull @NotNull java.util.function.Supplier<T> computation)
factory defines what the value will be, a holder try to get the value, and the value
obtained from there will be the value that will be obtained in subsequent calls to get the
value of the state.
State<Integer> intState = lazyState(ThreadLocalRandom.current()::nextInt);
intState.get(...); // 54 - from initial computation of random integer ^^
intState.get(...); // 54 - previously defined by the initial computation
T - The state holder type.computation - The value factory.<T> MutableState<T> initialState()
lazy state whose value is always computed
from the initial data set by its StateValueHost.
When the holder is a OpenViewContext, the initial value will be the value defined
in the initial opening data of the container. This state is specifically set for backwards
compatibility with the old way of applying data to a context before or during container open.
The class parameter is used to convert all initial state into a value. Note that support for obtaining a specific value from the initial data is only available from version 2.5.4 of the library.
T - The initial data type.<T> MutableState<T> initialState(@NotNull @NotNull java.lang.String key)
lazy state whose value is always computed
from the initial data set by its StateValueHost.
When the holder is a IFOpenContext, the initial value will be the value defined
in the initial opening data of the container. This state is specifically set for backwards
compatibility with the old way of applying data to a context before or during container open.
As to open a view it is necessary to pass a Map, the key is used to
get the value from that map.
T - The initial data value type.key - The initial data identifier.<T> State<Pagination> paginationState(@NotNull @NotNull java.util.List<? super T> sourceProvider, @NotNull @NotNull PaginationValueConsumer<Context,ItemBuilder,T> elementConsumer)
T - The pagination data type.sourceProvider - The data source for pagination.elementConsumer - The function for creating pagination items, this function is called for
each paged element (item) on a page.<T> State<Pagination> computedPaginationState(@NotNull @NotNull java.util.function.Function<Context,java.util.List<? super T>> sourceProvider, @NotNull @NotNull PaginationValueConsumer<Context,ItemBuilder,T> valueConsumer)
T - The pagination data type.sourceProvider - Data source for pagination.valueConsumer - Function for creating pagination items, this function is called for
each paged element (item) on a page.@ApiStatus.Experimental <T> State<Pagination> computedAsyncPaginationState(@NotNull @NotNull java.util.function.Function<Context,java.util.concurrent.CompletableFuture<java.util.List<T>>> sourceProvider, @NotNull @NotNull PaginationValueConsumer<Context,ItemBuilder,T> valueConsumer)
This API is experimental and is not subject to the general compatibility guarantees such API may be changed or may be removed completely in any further release.
T - The pagination data type.sourceProvider - The data source for pagination.valueConsumer - The function for creating pagination items, this function is called for
each paged element (item) on a page.<T> State<Pagination> lazyPaginationState(@NotNull @NotNull java.util.function.Function<Context,java.util.List<? super T>> sourceProvider, @NotNull @NotNull PaginationValueConsumer<Context,ItemBuilder,T> valueConsumer)
T - The pagination data type.sourceProvider - Data source for pagination.valueConsumer - Function for creating pagination items, this function is called for
each paged element (item) on a page.<T> State<Pagination> lazyPaginationState(@NotNull @NotNull java.util.function.Supplier<java.util.List<? super T>> sourceProvider, @NotNull @NotNull PaginationValueConsumer<Context,ItemBuilder,T> valueConsumer)
T - The pagination data type.sourceProvider - Data source for pagination.valueConsumer - Function for creating pagination items, this function is called for
each paged element (item) on a page.@ApiStatus.Experimental <T> State<Pagination> lazyAsyncPaginationState(@NotNull @NotNull java.util.function.Function<Context,java.util.concurrent.CompletableFuture<java.util.List<T>>> sourceProvider, @NotNull @NotNull PaginationValueConsumer<Context,ItemBuilder,T> valueConsumer)
This API is experimental and is not subject to the general compatibility guarantees such API may be changed or may be removed completely in any further release.
T - The pagination data type.sourceProvider - The data source for pagination.valueConsumer - The function for creating pagination items, this function is called for
each paged element (item) on a page.<T> PaginationStateBuilder<Context,ItemBuilder,T> buildPaginationState(@NotNull @NotNull java.util.List<? super T> sourceProvider)
T - The pagination data type.sourceProvider - The data source for pagination.<T> PaginationStateBuilder<Context,ItemBuilder,T> buildComputedPaginationState(@NotNull @NotNull java.util.function.Function<Context,java.util.List<? super T>> sourceProvider)
T - The pagination data type.sourceProvider - The data source for pagination.@ApiStatus.Experimental <T> PaginationStateBuilder<Context,ItemBuilder,T> buildComputedAsyncPaginationState(@NotNull @NotNull java.util.function.Function<Context,java.util.concurrent.CompletableFuture<java.util.List<T>>> sourceProvider)
This API is experimental and is not subject to the general compatibility guarantees such API may be changed or may be removed completely in any further release.
T - The pagination data type.sourceProvider - The data source for pagination.<T> PaginationStateBuilder<Context,ItemBuilder,T> buildLazyPaginationState(@NotNull @NotNull java.util.function.Supplier<java.util.List<? super T>> sourceProvider)
T - The pagination data type.sourceProvider - The data source for pagination.<T> PaginationStateBuilder<Context,ItemBuilder,T> buildLazyPaginationState(@NotNull @NotNull java.util.function.Function<Context,java.util.List<? super T>> sourceProvider)
T - The pagination data type.sourceProvider - The data source for pagination.@ApiStatus.Experimental <T> PaginationStateBuilder<Context,ItemBuilder,T> buildLazyAsyncPaginationState(@NotNull @NotNull java.util.function.Function<Context,java.util.concurrent.CompletableFuture<java.util.List<T>>> sourceProvider)
This API is experimental and is not subject to the general compatibility guarantees such API may be changed or may be removed completely in any further release.
T - The pagination data type.sourceProvider - The data source for pagination.