Package io.jmix.core.impl.metadata
Class GenerationStateStore<T>
java.lang.Object
io.jmix.core.impl.metadata.GenerationStateStore<T>
- Type Parameters:
T- type of generation-local state
Stores lazily created state objects keyed by metadata generation identifier.
Intended for singleton services that need separate caches or derived structures for each published metadata generation.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Removes cached state of all metadata generations.@Nullable Tget(long generationId) Returns cached state for the specified metadata generation.getOrCreate(long generationId, Supplier<T> factory) Returns state associated with the specified metadata generation, creating it lazily when absent.voidremove(long generationId) Removes cached state of the specified metadata generation.
-
Field Details
-
states
-
-
Constructor Details
-
GenerationStateStore
public GenerationStateStore()
-
-
Method Details
-
getOrCreate
Returns state associated with the specified metadata generation, creating it lazily when absent.- Parameters:
generationId- metadata generation identifierfactory- state factory used for the first access to the generation- Returns:
- generation-local state
-
get
Returns cached state for the specified metadata generation.- Parameters:
generationId- metadata generation identifier- Returns:
- generation-local state or
nullif it has not been created
-
remove
public void remove(long generationId) Removes cached state of the specified metadata generation.- Parameters:
generationId- metadata generation identifier
-
clear
public void clear()Removes cached state of all metadata generations.
-