@API(status=EXPERIMENTAL,
since="1.2.3")
public interface Store<T>
Modifier and Type | Interface and Description |
---|---|
static class |
Store.Lifespan
A Store with the same identifier can live
For the whole test run
For the currently running property
For the currently running try
|
static class |
Store.StoreFacade |
Modifier and Type | Method and Description |
---|---|
static <T> Store<T> |
create(java.lang.Object identifier,
Store.Lifespan lifespan,
java.util.function.Supplier<T> initializer)
Create a new store for storing and retrieving values and objects in lifecycle
hooks and lifecycle-dependent methods.
|
T |
get() |
static <T> Store<T> |
get(java.lang.Object identifier)
Retrieve a store that must be created somewhere else.
|
static <T> Store<T> |
getOrCreate(java.lang.Object identifier,
Store.Lifespan lifespan,
java.util.function.Supplier<T> initializer)
Find an existing store or create a new one if it doesn't exist
|
Store.Lifespan |
lifespan() |
void |
reset() |
void |
update(java.util.function.Function<T,T> updater) |
T get()
Store.Lifespan lifespan()
void reset()
static <T> Store<T> create(java.lang.Object identifier, Store.Lifespan lifespan, java.util.function.Supplier<T> initializer)
T
- The type of object to storeidentifier
- Any object to identify a store. Must be globally unique.lifespan
- initializer
- static <T> Store<T> getOrCreate(java.lang.Object identifier, Store.Lifespan lifespan, java.util.function.Supplier<T> initializer)
T
- The type of object to storeidentifier
- Any object to identify a store. Must be globally unique.lifespan
- initializer
- static <T> Store<T> get(java.lang.Object identifier)
T
- The type of object to storeidentifier
- Any object to identify a store. Must be globally unique.CannotFindStoreException