Package io.github.mrtesz.teszcore.config
Class YamlConfig
java.lang.Object
io.github.mrtesz.teszcore.config.YamlConfig
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDefault(@NotNull String path, Object value) Add a new entry to the defaults mapstatic YamlConfig.Builderbuilder()Generate a YamlConfig builderbooleanSee if a path contains a valuecopy()Copy the executing classbooleanexists()See if the YAML file existsCollect all paths of the YAMLbooleangetBoolean(@NotNull String path) booleangetBoolean(@NotNull String path, boolean def) getBooleanOrNull(@NotNull String path) doubledoublegetDoubleOrNull(@NotNull String path) floatfloatgetFloatOrNull(@NotNull String path) intintgetIntOrNull(@NotNull String path) longlonggetLongOrNull(@NotNull String path) Return all paths under the given parent pathgetRaw()Get the raw data of the YAMLshortshortgetShortOrNull(@NotNull String path) getStringList(@NotNull String path) getStringList(@NotNull String path, List<String> def) getStringListOrNull(@NotNull String path) voidload()Creates the file or directory if not existent and loads the data of the YAML filevoidsave()Saves the current data to the YAML filevoidSaves the current data to the YAML filevoidSets a value in the YAML filevoidsetDefault(@NotNull String path, Object value) Saves a value to the YAML file if the path is empty
-
Method Details
-
load
Creates the file or directory if not existent and loads the data of the YAML file- Throws:
YamlConfigException- when an I/O error occurs
-
save
Saves the current data to the YAML file- Throws:
YamlConfigException- when an I/O error occurs
-
save
Saves the current data to the YAML file- Parameters:
cs- `cs` of `OutputStreamWriter(OutputStream, Charset)`- Throws:
YamlConfigException- when an I/O error occurs
-
addDefault
-
setDefault
-
set
-
getString
-
getString
-
getInt
-
getInt
-
getIntOrNull
-
getLong
-
getLong
-
getLongOrNull
-
getFloat
-
getFloat
-
getFloatOrNull
-
getShort
-
getShort
-
getShortOrNull
-
getDouble
-
getDouble
-
getDoubleOrNull
-
getBoolean
-
getBoolean
-
getBooleanOrNull
-
getStringList
-
getStringList
-
getStringListOrNull
-
contains
See if a path contains a value- Parameters:
path- Path- Returns:
- if the path contains a value
-
exists
public boolean exists()See if the YAML file exists- Returns:
- true if the YAML file exists
-
getRaw
-
getAllPaths
-
getPaths
Return all paths under the given parent path- Parameters:
parent- Path to the parent section (e.g. `database`)- Returns:
- all paths under the given parent path (e.g. `database.host`, `database.port`), or empty if the path does not exist or is not a section
-
builder
Generate a YamlConfig builder- Returns:
- a YamlConfig builder
-
copy
Description copied from interface:CopyableCopy the executing class- Specified by:
copyin interfaceCopyable<YamlConfig>- Returns:
- a copy of the class executed in
-