Package me.hsgamer.hscore.config.path
Class BaseConfigPath<T>
java.lang.Object
me.hsgamer.hscore.config.path.BaseConfigPath<T>
- Type Parameters:
T- the type of the value
- All Implemented Interfaces:
ConfigPath<T>
- Direct Known Subclasses:
BooleanConfigPath,DoubleConfigPath,FloatConfigPath,IntegerConfigPath,LongConfigPath,SimpleConfigPath,StringConfigPath
A simple config path
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@Nullable ConfigGet the config@NotNull StringgetPath()Get the path to the valuegetValue()Get the valueGet the value from the config.voidmigrateConfig(@NotNull Config config) Manually update the config (Mainly used when updating new settings)voidSet the config.voidSet the valuevoidSet the value to the config.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface me.hsgamer.hscore.config.path.ConfigPath
reload, setAndSave, setAndSave
-
Constructor Details
-
BaseConfigPath
public BaseConfigPath(@NotNull @NotNull String path, @Nullable T def, @NotNull @NotNull Function<Object, T> typeConverter) Create a config path- Parameters:
path- the path to the valuedef- the default value if it's not foundtypeConverter- how to convert the raw object to the needed type of value
-
-
Method Details
-
getValue
Description copied from interface:ConfigPathGet the value- Specified by:
getValuein interfaceConfigPath<T>- Returns:
- the value
-
setValue
Description copied from interface:ConfigPathSet the value- Specified by:
setValuein interfaceConfigPath<T>- Parameters:
value- the value
-
getValue
Description copied from interface:ConfigPathGet the value from the config. This is used to get the value from multiple configs.- Specified by:
getValuein interfaceConfigPath<T>- Parameters:
config- the config- Returns:
- the value
-
setValue
Description copied from interface:ConfigPathSet the value to the config. This is used to set the value to multiple configs.- Specified by:
setValuein interfaceConfigPath<T>- Parameters:
value- the valueconfig- the config
-
getPath
Description copied from interface:ConfigPathGet the path to the value- Specified by:
getPathin interfaceConfigPath<T>- Returns:
- the path
-
getConfig
Description copied from interface:ConfigPathGet the config- Specified by:
getConfigin interfaceConfigPath<T>- Returns:
- the config
-
setConfig
Description copied from interface:ConfigPathSet the config.- Specified by:
setConfigin interfaceConfigPath<T>- Parameters:
config- the config
-
migrateConfig
Description copied from interface:ConfigPathManually update the config (Mainly used when updating new settings)- Specified by:
migrateConfigin interfaceConfigPath<T>- Parameters:
config- the config
-