Class EnumValueSource<K,SV extends Enum<SV>>
java.lang.Object
io.github.projectunified.valuevenue.common.EnumValueSource<K,SV>
- Type Parameters:
K- type of the keySV- enum type of the source value
- All Implemented Interfaces:
ValueSource<K,,SV> Function<K,List<SV>>
A
ValueSource whose source values are all constants of an enum, exposed as a single variable.
The variable is DEFAULT_KEY unless another key is given to the constructor. Override
ValueSource.replace(String, Object) to add more variables, calling the default for the rest.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionEnumValueSource(Class<SV> enumType) Creates the source withDEFAULT_KEY.EnumValueSource(String key, Class<SV> enumType) Creates the source. -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.github.projectunified.valuevenue.core.ValueSource
apply, getSourceValueStream, isSourceValueActivated
-
Field Details
-
DEFAULT_KEY
The key used when none is given.- See Also:
-
-
Constructor Details
-
EnumValueSource
Creates the source withDEFAULT_KEY.- Parameters:
enumType- enum whose constants are the source values
-
EnumValueSource
Creates the source.- Parameters:
key- name of the variable holding the constant itselfenumType- enum whose constants are the source values
-
-
Method Details
-
getSourceValueStream
Description copied from interface:ValueSourceAll source values that do not depend on a key.Empty by default: a source that only knows its values through
ValueSource.getSourceValueStream(Object)needs no override.- Specified by:
getSourceValueStreamin interfaceValueSource<K,SV extends Enum<SV>> - Returns:
- stream of every key-independent source value
-
replace
Description copied from interface:ValueSourceResolves a variable of the source value.
-