Class StandaloneConfig
java.lang.Object
com.kamikazejam.kamicommon.configuration.standalone.AbstractConfig<YamlConfigurationStandalone>
com.kamikazejam.kamicommon.configuration.standalone.StandaloneConfig
- All Implemented Interfaces:
ConfigurationMethods<ConfigurationSectionStandalone>,ConfigurationSectionStandalone
- Direct Known Subclasses:
StandaloneConfigExt
public class StandaloneConfig
extends AbstractConfig<YamlConfigurationStandalone>
implements ConfigurationSectionStandalone
A class that represents a configuration file (Meant for implementations WITHOUT a JavaPlugin object available)
If you have a JavaPlugin object, it is recommended to use @KamiConfig instead
This is an extension of a YamlConfiguration, so all get, set, and put methods are available.
IF extending this class, provide the File to the config in the super, and then add all desired comments
Then you can use this object just like a YamlConfiguration, it has all the same methods plus
If you have a JavaPlugin object, it is recommended to use @KamiConfig instead
This is an extension of a YamlConfiguration, so all get, set, and put methods are available.
IF extending this class, provide the File to the config in the super, and then add all desired comments
Then you can use this object just like a YamlConfiguration, it has all the same methods plus
AbstractConfig.save() and reload() -
Constructor Summary
ConstructorsConstructorDescriptionStandaloneConfig(@NotNull LoggerService logger, @NotNull ConfigSource source, @Nullable Supplier<InputStream> defaultsStream) StandaloneConfig(@NotNull LoggerService logger, @NotNull File file) Creates a new config instance with the given logger and destination file.
This constructor enables defaults using the following resource file method:
- Assumes a resource file with the same name as the provided file, exists in the current jar.
- SeegetDefaultIS(LoggerService, File)StandaloneConfig(@NotNull LoggerService logger, @NotNull File file, @Nullable Supplier<InputStream> defaultsStream) Creates a new config instance with the given logger and destination file.
This constructor uses defaults if and only if the provided supplier is NOT null:
- Providing a non-null supplier will enable defaults using the provided InputStream - Providing a null supplier will disable defaults -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDefault(String key, Object o) booleangetBigDecimal(String key) getBigDecimal(String key, BigDecimal def) booleangetBoolean(String key) booleangetBoolean(String key, boolean def) bytebytegetByteList(String key) getByteList(String key, List<Byte> def) @NotNull MemorySectionStandalone@NotNull ConfigurationSequenceStandalonestatic @UnknownNullability InputStreamgetDefaultIS(@NotNull LoggerService logger, File configFile) doubledoublefloatfloatintintgetIntegerList(String key) getIntegerList(String key, List<Integer> def) getKeys(boolean deep) Returns the keys of the config If Deep is enabled, it will dig and find all valid keys that resolve to a valueList<?>List<?>longlongshortshort@NotNull ConfigSourcegetStringList(String key) getStringList(String key, List<String> def) protected YamlConfigurationStandalonebooleanbooleanbooleanbooleanbooleanisEmpty()booleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanvoidvoidputBoolean(String key, boolean value) voidvoidvoidvoidvoidputInteger(String key, int value) voidvoidvoidvoidreload()Reloads the config from the filevoidvoidsetBoolean(String key, boolean value) voidvoidvoidvoidvoidsetInteger(String key, int value) voidvoidvoidMethods inherited from class com.kamikazejam.kamicommon.configuration.standalone.AbstractConfig
isChanged, save, save, setChangedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.kamikazejam.kamicommon.yaml.base.ConfigurationMethods
isChanged, setChanged
-
Constructor Details
-
StandaloneConfig
Creates a new config instance with the given logger and destination file.
This constructor enables defaults using the following resource file method:
- Assumes a resource file with the same name as the provided file, exists in the current jar.
- SeegetDefaultIS(LoggerService, File) -
StandaloneConfig
public StandaloneConfig(@NotNull @NotNull LoggerService logger, @NotNull @NotNull File file, @Nullable @Nullable Supplier<InputStream> defaultsStream) Creates a new config instance with the given logger and destination file.
This constructor uses defaults if and only if the provided supplier is NOT null:
- Providing a non-null supplier will enable defaults using the provided InputStream - Providing a null supplier will disable defaults- Parameters:
defaultsStream- The optional supplier to load defaults from.
-
StandaloneConfig
public StandaloneConfig(@NotNull @NotNull LoggerService logger, @NotNull @NotNull ConfigSource source, @Nullable @Nullable Supplier<InputStream> defaultsStream)
-
-
Method Details
-
reload
public void reload()Description copied from class:AbstractConfigReloads the config from the file- Specified by:
reloadin classAbstractConfig<YamlConfigurationStandalone>
-
getYamlConfiguration
- Specified by:
getYamlConfigurationin classAbstractConfig<YamlConfigurationStandalone>- Returns:
- The YamlConfiguration associated with this config
-
getSource
- Specified by:
getSourcein classAbstractConfig<YamlConfigurationStandalone>- Returns:
- The file associated with this config
-
set
- Specified by:
setin interfaceConfigurationMethods<ConfigurationSectionStandalone>
-
put
- Specified by:
putin interfaceConfigurationMethods<ConfigurationSectionStandalone>
-
putString
- Specified by:
putStringin interfaceConfigurationMethods<ConfigurationSectionStandalone>
-
putBoolean
- Specified by:
putBooleanin interfaceConfigurationMethods<ConfigurationSectionStandalone>
-
putByte
- Specified by:
putBytein interfaceConfigurationMethods<ConfigurationSectionStandalone>
-
putShort
- Specified by:
putShortin interfaceConfigurationMethods<ConfigurationSectionStandalone>
-
putInteger
- Specified by:
putIntegerin interfaceConfigurationMethods<ConfigurationSectionStandalone>
-
putInt
- Specified by:
putIntin interfaceConfigurationMethods<ConfigurationSectionStandalone>
-
putLong
- Specified by:
putLongin interfaceConfigurationMethods<ConfigurationSectionStandalone>
-
putDouble
- Specified by:
putDoublein interfaceConfigurationMethods<ConfigurationSectionStandalone>
-
putFloat
- Specified by:
putFloatin interfaceConfigurationMethods<ConfigurationSectionStandalone>
-
setString
- Specified by:
setStringin interfaceConfigurationMethods<ConfigurationSectionStandalone>
-
setBoolean
- Specified by:
setBooleanin interfaceConfigurationMethods<ConfigurationSectionStandalone>
-
setByte
- Specified by:
setBytein interfaceConfigurationMethods<ConfigurationSectionStandalone>
-
setShort
- Specified by:
setShortin interfaceConfigurationMethods<ConfigurationSectionStandalone>
-
setInteger
- Specified by:
setIntegerin interfaceConfigurationMethods<ConfigurationSectionStandalone>
-
setInt
- Specified by:
setIntin interfaceConfigurationMethods<ConfigurationSectionStandalone>
-
setLong
- Specified by:
setLongin interfaceConfigurationMethods<ConfigurationSectionStandalone>
-
setDouble
- Specified by:
setDoublein interfaceConfigurationMethods<ConfigurationSectionStandalone>
-
setFloat
- Specified by:
setFloatin interfaceConfigurationMethods<ConfigurationSectionStandalone>
-
get
- Specified by:
getin interfaceConfigurationMethods<ConfigurationSectionStandalone>
-
get
- Specified by:
getin interfaceConfigurationMethods<ConfigurationSectionStandalone>
-
getConfigurationSection
- Specified by:
getConfigurationSectionin interfaceConfigurationMethods<ConfigurationSectionStandalone>
-
getConfigurationSequence
- Specified by:
getConfigurationSequencein interfaceConfigurationMethods<ConfigurationSectionStandalone>
-
getString
- Specified by:
getStringin interfaceConfigurationMethods<ConfigurationSectionStandalone>
-
getString
- Specified by:
getStringin interfaceConfigurationMethods<ConfigurationSectionStandalone>
-
isString
- Specified by:
isStringin interfaceConfigurationMethods<ConfigurationSectionStandalone>
-
getInt
- Specified by:
getIntin interfaceConfigurationMethods<ConfigurationSectionStandalone>
-
getInt
- Specified by:
getIntin interfaceConfigurationMethods<ConfigurationSectionStandalone>
-
isInt
- Specified by:
isIntin interfaceConfigurationMethods<ConfigurationSectionStandalone>
-
getLong
- Specified by:
getLongin interfaceConfigurationMethods<ConfigurationSectionStandalone>
-
getLong
- Specified by:
getLongin interfaceConfigurationMethods<ConfigurationSectionStandalone>
-
isLong
- Specified by:
isLongin interfaceConfigurationMethods<ConfigurationSectionStandalone>
-
getList
- Specified by:
getListin interfaceConfigurationMethods<ConfigurationSectionStandalone>
-
getList
- Specified by:
getListin interfaceConfigurationMethods<ConfigurationSectionStandalone>
-
isList
- Specified by:
isListin interfaceConfigurationMethods<ConfigurationSectionStandalone>
-
getBoolean
- Specified by:
getBooleanin interfaceConfigurationMethods<ConfigurationSectionStandalone>
-
getBoolean
- Specified by:
getBooleanin interfaceConfigurationMethods<ConfigurationSectionStandalone>
-
isBoolean
- Specified by:
isBooleanin interfaceConfigurationMethods<ConfigurationSectionStandalone>
-
getStringList
- Specified by:
getStringListin interfaceConfigurationMethods<ConfigurationSectionStandalone>
-
getStringList
- Specified by:
getStringListin interfaceConfigurationMethods<ConfigurationSectionStandalone>
-
getIntegerList
- Specified by:
getIntegerListin interfaceConfigurationMethods<ConfigurationSectionStandalone>
-
getIntegerList
- Specified by:
getIntegerListin interfaceConfigurationMethods<ConfigurationSectionStandalone>
-
getByteList
- Specified by:
getByteListin interfaceConfigurationMethods<ConfigurationSectionStandalone>
-
getByteList
- Specified by:
getByteListin interfaceConfigurationMethods<ConfigurationSectionStandalone>
-
getDouble
- Specified by:
getDoublein interfaceConfigurationMethods<ConfigurationSectionStandalone>
-
getDouble
- Specified by:
getDoublein interfaceConfigurationMethods<ConfigurationSectionStandalone>
-
isDouble
- Specified by:
isDoublein interfaceConfigurationMethods<ConfigurationSectionStandalone>
-
getByte
- Specified by:
getBytein interfaceConfigurationMethods<ConfigurationSectionStandalone>
-
getByte
- Specified by:
getBytein interfaceConfigurationMethods<ConfigurationSectionStandalone>
-
isByte
- Specified by:
isBytein interfaceConfigurationMethods<ConfigurationSectionStandalone>
-
getShort
- Specified by:
getShortin interfaceConfigurationMethods<ConfigurationSectionStandalone>
-
getShort
- Specified by:
getShortin interfaceConfigurationMethods<ConfigurationSectionStandalone>
-
isShort
- Specified by:
isShortin interfaceConfigurationMethods<ConfigurationSectionStandalone>
-
getFloat
- Specified by:
getFloatin interfaceConfigurationMethods<ConfigurationSectionStandalone>
-
getFloat
- Specified by:
getFloatin interfaceConfigurationMethods<ConfigurationSectionStandalone>
-
isFloat
- Specified by:
isFloatin interfaceConfigurationMethods<ConfigurationSectionStandalone>
-
getBigDecimal
- Specified by:
getBigDecimalin interfaceConfigurationMethods<ConfigurationSectionStandalone>
-
getBigDecimal
- Specified by:
getBigDecimalin interfaceConfigurationMethods<ConfigurationSectionStandalone>
-
isNumber
- Specified by:
isNumberin interfaceConfigurationMethods<ConfigurationSectionStandalone>
-
getKeys
Returns the keys of the config If Deep is enabled, it will dig and find all valid keys that resolve to a value- Specified by:
getKeysin interfaceConfigurationMethods<ConfigurationSectionStandalone>- Parameters:
deep- Whether to search for all sub-keys- Returns:
- The list of keys found
-
isConfigurationSection
- Specified by:
isConfigurationSectionin interfaceConfigurationMethods<ConfigurationSectionStandalone>
-
contains
- Specified by:
containsin interfaceConfigurationMethods<ConfigurationSectionStandalone>
-
isSet
- Specified by:
isSetin interfaceConfigurationMethods<ConfigurationSectionStandalone>
-
addDefault
- Specified by:
addDefaultin interfaceConfigurationMethods<ConfigurationSectionStandalone>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceConfigurationMethods<ConfigurationSectionStandalone>
-
getCurrentPath
- Specified by:
getCurrentPathin interfaceConfigurationMethods<ConfigurationSectionStandalone>
-
getDefaultIS
public static @UnknownNullability InputStream getDefaultIS(@NotNull @NotNull LoggerService logger, File configFile)
-