Package me.datafox.dfxengine.text.api
Class ConfigurationKey<T>
java.lang.Object
me.datafox.dfxengine.text.api.ConfigurationKey<T>
Data class that is used as a key for
TextConfiguration. Contains a hidden index to keep the hashcode unique
and a default value that is used when the configured value is not set or cannot be obtained.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> ConfigurationKey<T> of()Any class calling this method must also callsetDefaultValue(Object)on the returned configuration key.static <T> ConfigurationKey<T> of(T defaultValue) voidsetDefaultValue(T defaultValue)
-
Constructor Details
-
ConfigurationKey
public ConfigurationKey()
-
-
Method Details
-
setDefaultValue
- Parameters:
defaultValue- value to be set as the default value- Throws:
UnsupportedOperationException- if the default value has already been set
-
of
- Type Parameters:
T- type of the value of this configuration key- Parameters:
defaultValue- default value for the configuration key- Returns:
- new
ConfigurationKeywith the specified default value
-
of
Any class calling this method must also callsetDefaultValue(Object)on the returned configuration key.- Type Parameters:
T- type of the value of this configuration key- Returns:
- new
ConfigurationKeywith the specified default value
-