Class ConfigSection
-
public class ConfigSectionA wrapper around ConfigurationSection providing useful utilities for reading/writing.
All get calls are cached, so performance is generally a non-issue here.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final classConfigSection.KeyNotFoundExceptionThrown when a key is not found.
-
Constructor Summary
Constructors Constructor Description ConfigSection(ConfigurationSection internalSection)
-
Method Summary
Modifier and Type Method Description final ConfigurationSectiongetInternalSection()final Set<String>getKeys()Returns all the keys in the section. final Set<ConfigSection>getSections()Gets all the values in the section that are themselves sections. final ConfigSectiongetSection(String key)final ConfigSectiongetSectionOrThrow(String key)final <T extends Any> Tget(String key, ConfigAdapter<T> adapter)Returns null if the key does not exist or if the value cannot be converted to the desired type. final <T extends Any> Tget(String key, ConfigAdapter<T> adapter, T defaultValue)Returns defaultValue if the key does not exist or if the value cannot be converted to the desired type. final <T extends Any> TgetOrThrow(String key, ConfigAdapter<T> adapter)Throws an error if the key does not exist or if the value cannot be converted to the desired type. final <T extends Any> voidset(String key, T value)final ConfigSectioncreateSection(String key)final voidmerge(ConfigSection other)'Merges' other with this ConfigSection by copying all of its keys into this ConfigSection. -
-
Constructor Detail
-
ConfigSection
ConfigSection(ConfigurationSection internalSection)
-
-
Method Detail
-
getInternalSection
final ConfigurationSection getInternalSection()
-
getSections
final Set<ConfigSection> getSections()
Gets all the values in the section that are themselves sections.
-
getSection
final ConfigSection getSection(String key)
-
getSectionOrThrow
final ConfigSection getSectionOrThrow(String key)
-
get
final <T extends Any> T get(String key, ConfigAdapter<T> adapter)
Returns null if the key does not exist or if the value cannot be converted to the desired type.
-
get
final <T extends Any> T get(String key, ConfigAdapter<T> adapter, T defaultValue)
Returns defaultValue if the key does not exist or if the value cannot be converted to the desired type.
-
getOrThrow
final <T extends Any> T getOrThrow(String key, ConfigAdapter<T> adapter)
Throws an error if the key does not exist or if the value cannot be converted to the desired type.
-
createSection
final ConfigSection createSection(String key)
-
merge
final void merge(ConfigSection other)
'Merges' other with this ConfigSection by copying all of its keys into this ConfigSection. If a key exists in both section, this ConfigSection's keys take priority.
-
-
-
-