Class Setting<T>
- java.lang.Object
-
- com.djrapitops.plan.settings.config.paths.key.Setting<T>
-
- Direct Known Subclasses:
BooleanSetting
,IntegerSetting
,StringListSetting
,StringSetting
,TimeSetting
public abstract class Setting<T> extends java.lang.Object
Represents a path to a config value.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String
path
-
Constructor Summary
Constructors Modifier Constructor Description protected
Setting(java.lang.String path, Type<T> type)
protected
Setting(java.lang.String path, Type<T> type, java.util.function.Predicate<T> validator)
protected
Setting(java.lang.String path, java.lang.Class<T> type)
protected
Setting(java.lang.String path, java.lang.Class<T> type, java.util.function.Predicate<T> validator)
protected
Setting(java.lang.String path, java.util.function.Predicate<T> validator, T defaultValue)
protected
Setting(java.lang.String path, T defaultValue)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description T
getDefaultValue()
java.lang.String
getPath()
Used to get the String path of a the config setting.abstract T
getValueFrom(ConfigNode node)
boolean
isInvalid(T value)
boolean
isValid(T value)
static <T> boolean
nullValidator(T value)
static boolean
timeValidator(java.lang.Number number)
java.lang.String
toString()
-
-
-
Constructor Detail
-
Setting
protected Setting(java.lang.String path, java.lang.Class<T> type)
-
Setting
protected Setting(java.lang.String path, java.lang.Class<T> type, java.util.function.Predicate<T> validator)
-
Setting
protected Setting(java.lang.String path, Type<T> type, java.util.function.Predicate<T> validator)
-
Setting
protected Setting(java.lang.String path, T defaultValue)
-
-
Method Detail
-
nullValidator
public static <T> boolean nullValidator(T value)
-
timeValidator
public static boolean timeValidator(java.lang.Number number)
-
getPath
public java.lang.String getPath()
Used to get the String path of a the config setting.Path separates nested levels with a dot.
- Returns:
- Example: Settings.WebServer.Enabled
-
getValueFrom
public abstract T getValueFrom(ConfigNode node)
-
isValid
public boolean isValid(T value)
-
isInvalid
public boolean isInvalid(T value)
-
getDefaultValue
public T getDefaultValue()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-