Package com.avanza.astrix.config
Interface Setting<T>
-
- Type Parameters:
T-
- All Known Implementing Classes:
BooleanSetting,EnumSetting,IntSetting,LongSetting,StringSetting
public interface Setting<T>This is an abstraction for an application/framework setting. A Setting can be read from aDynamicConfiginstance. It has a name and also an associated default value which is used when a DynamicConfig instance does not hold a value for this Setting.The Setting abstraction is parameterized with the type of the given setting.
- Author:
- Elias Lindholm (elilin)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description TdefaultValue()The default value for this setting.DynamicProperty<T>getFrom(DynamicConfig config)Reads this Setting from the givenDynamicConfiginstance.Stringname()The name of this Setting.
-
-
-
Method Detail
-
name
String name()
The name of this Setting. Used when reading this Setting from a DynamicConfig instance.
-
getFrom
DynamicProperty<T> getFrom(DynamicConfig config)
Reads this Setting from the givenDynamicConfiginstance. If the DynamicConfig instance does not hold a value for this Setting, then the default value will be returned.- Parameters:
config- DynamicConfig instance to read this setting from- Returns:
- This value of this setting in the given
DynamicConfiginstance, or the default value if the DynamicConfig instance does not contain a value for this Setting
-
defaultValue
T defaultValue()
The default value for this setting. For settings of primitive types this method returns the boxed version of the given type, and never returns null.
-
-