Class EnumValueGenerator<K,SV extends Enum<SV>,FV>
java.lang.Object
io.github.projectunified.valuevenue.core.CachedValueGenerator<K,SV,FV>
io.github.projectunified.valuevenue.core.EnumValueGenerator<K,SV,FV>
- Type Parameters:
K- type of the key used to select valuesSV- enum type of the source valueFV- type of the final value
public abstract class EnumValueGenerator<K,SV extends Enum<SV>,FV>
extends CachedValueGenerator<K,SV,FV>
A
CachedValueGenerator whose source values are all constants of an enum.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionEnum whose constants are the source values.All source values the generator knows without a key, soCachedValueGenerator.update()can create their cache entries upfront.Methods inherited from class io.github.projectunified.valuevenue.core.CachedValueGenerator
apply, getCachedValues, getSourceValueStream, isSourceValueActivated, isValueActivated, mapToFinalValue, update
-
Constructor Details
-
EnumValueGenerator
public EnumValueGenerator()
-
-
Method Details
-
getEnumType
Enum whose constants are the source values.CachedValueGenerator.update()creates the cache entries of all of them upfront. Must return the same type on every call; it is read once to cache the constants.- Returns:
- enum type of the source values
-
getSourceValueStream
Description copied from class:CachedValueGeneratorAll source values the generator knows without a key, soCachedValueGenerator.update()can create their cache entries upfront. Empty by default: a key-only generator needs no override, while its entries are created lazily byCachedValueGenerator.apply(Object). Values that can only be reached through a key are returned byCachedValueGenerator.getSourceValueStream(Object)instead.- Overrides:
getSourceValueStreamin classCachedValueGenerator<K,SV extends Enum<SV>, FV> - Returns:
- stream of every key-independent source value
-