Class FileReader
java.lang.Object
io.github.monsieurdoceo.filizer.storage.infrastructure.FileReader
Provides access to a managed file configuration.
Offers convenient methods for retrieving values,
configuration sections, and keys from a FileConfiguration.
-
Constructor Summary
ConstructorsConstructorDescriptionFileReader(org.bukkit.configuration.file.FileConfiguration config) Creates a newFileReaderfrom a configuration instance. -
Method Summary
Modifier and TypeMethodDescriptionRetrieves a raw value from the configuration.doubleRetrieves an double value from the configuration.intRetrieves an integer value from the configuration.getIntegerList(String path) Retrieves an integer list from the configuration.getKeys(boolean deep) Retrieves all keys from the root configuration.Retrieves keys from a specific configuration section.org.bukkit.configuration.ConfigurationSectiongetSection(String path) Retrieves a configuration section.Retrieves a string value from the configuration.getStringList(String path) Retrieves a string list from the configuration.booleanChecks whether a configuration path exists.
-
Constructor Details
-
FileReader
public FileReader(org.bukkit.configuration.file.FileConfiguration config) Creates a newFileReaderfrom a configuration instance.- Parameters:
config- the backing configuration
-
-
Method Details
-
get
Retrieves a raw value from the configuration.- Parameters:
path- the configuration path- Returns:
- the stored value, or
nullif absent
-
getString
Retrieves a string value from the configuration.- Parameters:
path- the configuration path- Returns:
- the stored string, or
nullif absent
-
getInt
Retrieves an integer value from the configuration.If the path is absent or not an integer,
0is returned.- Parameters:
path- the configuration path- Returns:
- the stored integer value
-
getDouble
Retrieves an double value from the configuration.If the path is absent or not an integer,
0.0is returned.- Parameters:
path- the configuration path- Returns:
- the stored integer value
-
getStringList
Retrieves a string list from the configuration.- Parameters:
path- the configuration path- Returns:
- the stored list, or
nullif absent
-
getIntegerList
Retrieves an integer list from the configuration.- Parameters:
path- the configuration path- Returns:
- the stored list, or
nullif absent
-
getSection
Retrieves a configuration section.- Parameters:
path- the configuration path- Returns:
- the matching section, or
nullif absent
-
getKeys
Retrieves all keys from the root configuration.- Parameters:
deep- whether nested keys should be included- Returns:
- a set containing configuration keys
-
getKeys
Retrieves keys from a specific configuration section.If the provided path is invalid or absent, root configuration keys are returned instead.
- Parameters:
path- the configuration section pathdeep- whether nested keys should be included- Returns:
- a set containing matching keys, or an empty set if the section does not exist
-
has
Checks whether a configuration path exists.- Parameters:
path- the configuration path- Returns:
trueif the path exists, otherwisefalse
-