Interface UnmodifiableConfig
- All Known Subinterfaces:
CommentedConfig,CommentedFileConfig,Config,FileConfig,UnmodifiableCommentedConfig
- All Known Implementing Classes:
AbstractCommentedConfig,AbstractConfig,CommentedConfigWrapper,ConfigWrapper,ConvertedCommentedConfig,ConvertedCommentedFileConfig,ConvertedConfig,ConvertedFileConfig,FakeCommentedConfig,FakeUnmodifiableCommentedConfig,UnmodifiableConfigWrapper
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceAn unmodifiable config entry. -
Method Summary
Modifier and TypeMethodDescriptiondefault <T> TFor scala: gets a config value.default <T> TFor scala: gets a config value.ConfigFormat<?>Returns the config's format.default booleanChecks if the config contains a value at some path.booleanChecks if the config contains a value at some path.Set<? extends UnmodifiableConfig.Entry>entrySet()Returns a Set view of the config's entries.default <T> TGets a value from the config.default <T> TGets a value from the config.default bytedefault bytedefault bytegetByteOrElse(String path, byte defaultValue) default bytegetByteOrElse(List<String> path, byte defaultValue) default charReturns a char value from the configuration.default charReturns a char value from the configuration.default chargetCharOrElse(String path, char defaultValue) Returns a char value from the configuration.default chargetCharOrElse(List<String> path, char defaultValue) Returns a char value from the configuration.default <T extends Enum<T>>
TCallsgetEnum(String, Class, EnumGetMethod)with methodEnumGetMethod.NAME_IGNORECASE.default <T extends Enum<T>>
TgetEnum(String path, Class<T> enumType, EnumGetMethod method) Gets an Enum value from the config.default <T extends Enum<T>>
TCallsgetEnum(List, Class, EnumGetMethod)with methodEnumGetMethod.NAME_IGNORECASE.default <T extends Enum<T>>
TgetEnum(List<String> path, Class<T> enumType, EnumGetMethod method) Gets an Enum value from the config.default <T extends Enum<T>>
TgetEnumOrElse(String path, Class<T> enumType, EnumGetMethod method, Supplier<T> defaultValueSupplier) Gets an Enum value from the config.default <T extends Enum<T>>
TgetEnumOrElse(String path, Class<T> enumType, Supplier<T> defaultValueSupplier) default <T extends Enum<T>>
TgetEnumOrElse(String path, T defaultValue) CallsgetEnumOrElse(String, Enum, EnumGetMethod)with methodEnumGetMethod.NAME_IGNORECASE.default <T extends Enum<T>>
TgetEnumOrElse(String path, T defaultValue, EnumGetMethod method) Gets an Enum value from the config.default <T extends Enum<T>>
TgetEnumOrElse(List<String> path, Class<T> enumType, EnumGetMethod method, Supplier<T> defaultValueSupplier) Gets an Enum value from the config.default <T extends Enum<T>>
TgetEnumOrElse(List<String> path, Class<T> enumType, Supplier<T> defaultValueSupplier) CallsgetEnumOrElse(List, Class, EnumGetMethod, Supplier)with methodEnumGetMethod.NAME_IGNORECASE.default <T extends Enum<T>>
TgetEnumOrElse(List<String> path, T defaultValue) CallsgetEnumOrElse(List, Enum, EnumGetMethod)with methodEnumGetMethod.NAME_IGNORECASE.default <T extends Enum<T>>
TgetEnumOrElse(List<String> path, T defaultValue, EnumGetMethod method) Gets an Enum value from the config.default intLikeget(String)but returns a primitive int.default intLikeget(List)but returns a primitive int.default intgetIntOrElse(String path, int defaultValue) LikegetOrElse(String, Object)but returns a primitive int.default intgetIntOrElse(String path, IntSupplier defaultValueSupplier) LikegetOrElse(String, Supplier)but returns a primitive int.default intgetIntOrElse(List<String> path, int defaultValue) LikegetOrElse(List, Object)but returns a primitive int.default intgetIntOrElse(List<String> path, IntSupplier defaultValueSupplier) LikegetOrElse(List, Supplier)but returns a primitive int.default longLikeget(String)but returns a primitive long.default longLikeget(List)but returns a primitive long.default longgetLongOrElse(String path, long defaultValue) LikegetOrElse(String, Object)but returns a primitive long.default longgetLongOrElse(String path, LongSupplier defaultValueSupplier) LikegetOrElse(String, Supplier)but returns a primitive long.default longgetLongOrElse(List<String> path, long defaultValue) LikegetOrElse(List, Object)but returns a primitive long.default longgetLongOrElse(List<String> path, LongSupplier defaultValueSupplier) LikegetOrElse(List, Supplier)but returns a primitive long.default <T> Optional<T>getOptional(String path) Gets an optional value from the config.default <T> Optional<T>getOptional(List<String> path) Gets an optional value from the config.getOptionalEnum(String path, Class<T> enumType) CallsgetOptionalEnum(String, Class, EnumGetMethod)with methodEnumGetMethod.NAME_IGNORECASE.getOptionalEnum(String path, Class<T> enumType, EnumGetMethod method) Gets an optional Enum value from the config.getOptionalEnum(List<String> path, Class<T> enumType) CallsgetOptionalEnum(List, Class, EnumGetMethod)with methodEnumGetMethod.NAME_IGNORECASE.getOptionalEnum(List<String> path, Class<T> enumType, EnumGetMethod method) Gets an optional Enum value from the config.default OptionalIntgetOptionalInt(String path) LikegetOptional(String)but returns a primitive int.default OptionalIntgetOptionalInt(List<String> path) LikegetOptional(List)but returns a primitive int.default OptionalLonggetOptionalLong(String path) LikegetOptional(String)but returns a primitive long.default OptionalLonggetOptionalLong(List<String> path) LikegetOptional(List)but returns a primitive long.default <T> TGets a value from the config.default <T> TGets a value from the config.default <T> TGets a value from the config.default <T> TGets a value from the config.default <T> TGets a value from the config.<T> TGets a value from the config.default shortdefault shortdefault shortgetShortOrElse(String path, short defaultValue) default shortgetShortOrElse(List<String> path, short defaultValue) default booleanisEmpty()Checks if the config is empty.default booleanChecks if the config contains a null value at some path.default booleanChecks if the config contains a null value at some path.intsize()Gets the size of the config.valueMap()Returns a Map view of the config's values.
-
Method Details
-
get
Gets a value from the config.- Type Parameters:
T- the value's type- Parameters:
path- the value's path, each part separated by a dot. Example "a.b.c"- Returns:
- the value at the given path, or
nullif there is no such value.
-
get
Gets a value from the config.- Type Parameters:
T- the value's type- Parameters:
path- the value's path, each element of the list is a different part of the path.- Returns:
- the value at the given path, or
nullif there is no such value.
-
getRaw
Gets a value from the config. Doesn't convertNullObject.NULL_OBJECTtonull.- Type Parameters:
T- the value's type- Parameters:
path- the value's path, each part separated by a dot. Example "a.b.c"- Returns:
- the value at the given path, or
nullif there is no such value.
-
getRaw
Gets a value from the config. Doesn't convertNullObject.NULL_OBJECTtonull.- Type Parameters:
T- the value's type- Parameters:
path- the value's path, each element of the list is a different part of the path.- Returns:
- the value at the given path, or
nullif there is no such value.
-
getOptional
Gets an optional value from the config.- Type Parameters:
T- the value's type- Parameters:
path- the value's path, each part separated by a dot. Example "a.b.c"- Returns:
- an Optional containing the value at the given path, or
Optional.empty()if there is no such value.
-
getOptional
Gets an optional value from the config.- Type Parameters:
T- the value's type- Parameters:
path- the value's path, each element of the list is a different part of the path.- Returns:
- an Optional containing the value at the given path, or
Optional.empty()if there is no such value.
-
getOrElse
Gets a value from the config. If the value doesn't exist, returns the default value.- Type Parameters:
T- the value's type- Parameters:
path- the value's path, each part separated by a dot. Example "a.b.c"defaultValue- the default value to return if not found- Returns:
- the value at the given path, or the default value if not found.
-
getOrElse
Gets a value from the config. If the value doesn't exist, returns the default value.- Type Parameters:
T- the value's type- Parameters:
path- the value's path, each element of the list is a different part of the path.defaultValue- the default value to return if not found- Returns:
- the value at the given path, or the default value if not found.
-
getOrElse
Gets a value from the config. If the value doesn't exist, returns the default value.- Type Parameters:
T- the value's type- Parameters:
path- the value's path, each element of the list is a different part of the path.defaultValueSupplier- the Supplier of the default value- Returns:
- the value at the given path, or the default value if not found.
-
getOrElse
Gets a value from the config. If the value doesn't exist, returns the default value.- Type Parameters:
T- the value's type- Parameters:
path- the value's path, each part separated by a dot. Example "a.b.c"defaultValueSupplier- the Supplier of the default value- Returns:
- the value at the given path, or the default value if not found.
-
getEnum
Gets an Enum value from the config. If the value doesn't exist, returns null.- Type Parameters:
T- the value's type- Parameters:
path- the value's path, each part separated by a dot. Example "a.b.c"enumType- the class of the Enummethod- the method to use when converting a non-enum value like a String or an int- Returns:
- the value at the given path as an enum, or null value if not found.
- Throws:
IllegalArgumentException- if the config contains a String that doesn't match any of the enum constants, with regards to the given methodClassCastException- if the config contains a value that cannot be converted to an enum constant, like a List
-
getEnum
CallsgetEnum(String, Class, EnumGetMethod)with methodEnumGetMethod.NAME_IGNORECASE. -
getEnum
Gets an Enum value from the config. If the value doesn't exist, returns null.- Type Parameters:
T- the value's type- Parameters:
path- the value's path, each element of the list is a different part of the path.enumType- the class of the Enummethod- the method to use when converting a non-enum value like a String or an int- Returns:
- the value at the given path as an enum, or null value if not found.
- Throws:
IllegalArgumentException- if the config contains a String that doesn't match any of the enum constants, with regards to the given methodClassCastException- if the config contains a value that cannot be converted to an enum constant, like a List
-
getEnum
CallsgetEnum(List, Class, EnumGetMethod)with methodEnumGetMethod.NAME_IGNORECASE. -
getOptionalEnum
default <T extends Enum<T>> Optional<T> getOptionalEnum(String path, Class<T> enumType, EnumGetMethod method) Gets an optional Enum value from the config.- Type Parameters:
T- the value's type- Parameters:
path- the value's path, each part separated by a dot. Example "a.b.c"enumType- the class of the Enummethod- the method to use when converting a non-enum value like a String or an int- Returns:
- the value at the given path as an enum, or null value if not found.
- Throws:
IllegalArgumentException- if the config contains a String that doesn't match any of the enum constants, with regards to the given methodClassCastException- if the config contains a value that cannot be converted to an enum constant, like a List
-
getOptionalEnum
CallsgetOptionalEnum(String, Class, EnumGetMethod)with methodEnumGetMethod.NAME_IGNORECASE. -
getOptionalEnum
default <T extends Enum<T>> Optional<T> getOptionalEnum(List<String> path, Class<T> enumType, EnumGetMethod method) Gets an optional Enum value from the config.- Type Parameters:
T- the value's type- Parameters:
path- the value's path, each element of the list is a different part of the path.enumType- the class of the Enummethod- the method to use when converting a non-enum value like a String or an int- Returns:
- the value at the given path as an enum, or null value if not found.
- Throws:
IllegalArgumentException- if the config contains a String that doesn't match any of the enum constants, with regards to the given methodClassCastException- if the config contains a value that cannot be converted to an enum constant, like a List
-
getOptionalEnum
CallsgetOptionalEnum(List, Class, EnumGetMethod)with methodEnumGetMethod.NAME_IGNORECASE. -
getEnumOrElse
Gets an Enum value from the config. If the value doesn't exist, returns the default value.- Type Parameters:
T- the value's type- Parameters:
path- the value's path, each part separated by a dot. Example "a.b.c"defaultValue- the default valuemethod- the method to use when converting a non-enum value like a String or an int- Returns:
- the value at the given path as an enum, or null value if not found.
- Throws:
IllegalArgumentException- if the config contains a String that doesn't match any of the enum constants, with regards to the given methodClassCastException- if the config contains a value that cannot be converted to an enum constant, like a List
-
getEnumOrElse
CallsgetEnumOrElse(String, Enum, EnumGetMethod)with methodEnumGetMethod.NAME_IGNORECASE. -
getEnumOrElse
default <T extends Enum<T>> T getEnumOrElse(List<String> path, T defaultValue, EnumGetMethod method) Gets an Enum value from the config. If the value doesn't exist, returns the default value.- Type Parameters:
T- the value's type- Parameters:
path- the value's path, each element of the list is a different part of the path.defaultValue- the default valuemethod- the method to use when converting a non-enum value like a String or an int- Returns:
- the value at the given path as an enum, or null value if not found.
- Throws:
IllegalArgumentException- if the config contains a String that doesn't match any of the enum constants, with regards to the given methodClassCastException- if the config contains a value that cannot be converted to an enum constant, like a List
-
getEnumOrElse
CallsgetEnumOrElse(List, Enum, EnumGetMethod)with methodEnumGetMethod.NAME_IGNORECASE. -
getEnumOrElse
default <T extends Enum<T>> T getEnumOrElse(String path, Class<T> enumType, EnumGetMethod method, Supplier<T> defaultValueSupplier) Gets an Enum value from the config. If the value doesn't exist, returns the default value.- Type Parameters:
T- the value's type- Parameters:
path- the value's path, each element of the list is a different part of the path.defaultValueSupplier- Supplier of the default value, only used if neededmethod- the method to use when converting a non-enum value like a String or an int- Returns:
- the value at the given path as an enum, or null value if not found.
- Throws:
IllegalArgumentException- if the config contains a String that doesn't match any of the enum constants, with regards to the given methodClassCastException- if the config contains a value that cannot be converted to an enum constant, like a List
-
getEnumOrElse
-
getEnumOrElse
default <T extends Enum<T>> T getEnumOrElse(List<String> path, Class<T> enumType, EnumGetMethod method, Supplier<T> defaultValueSupplier) Gets an Enum value from the config. If the value doesn't exist, returns the default value.- Type Parameters:
T- the value's type- Parameters:
path- the value's path, each element of the list is a different part of the path.defaultValueSupplier- Supplier of the default value, only used if neededmethod- the method to use when converting a non-enum value like a String or an int- Returns:
- the value at the given path as an enum, or null value if not found.
- Throws:
IllegalArgumentException- if the config contains a String that doesn't match any of the enum constants, with regards to the given methodClassCastException- if the config contains a value that cannot be converted to an enum constant, like a List
-
getEnumOrElse
default <T extends Enum<T>> T getEnumOrElse(List<String> path, Class<T> enumType, Supplier<T> defaultValueSupplier) CallsgetEnumOrElse(List, Class, EnumGetMethod, Supplier)with methodEnumGetMethod.NAME_IGNORECASE. -
getInt
Likeget(String)but returns a primitive int. The config's value must be aNumber. -
getInt
-
getOptionalInt
LikegetOptional(String)but returns a primitive int. The config's value must be aNumberor null or nonexistant. -
getOptionalInt
LikegetOptional(List)but returns a primitive int. The config's value must be aNumberor null or nonexistant. -
getIntOrElse
LikegetOrElse(String, Object)but returns a primitive int. The config's value must be aNumberor null or nonexistant. -
getIntOrElse
LikegetOrElse(List, Object)but returns a primitive int. The config's value must be aNumberor null or nonexistant. -
getIntOrElse
LikegetOrElse(String, Supplier)but returns a primitive int. The config's value must be aNumberor null or nonexistant. -
getIntOrElse
LikegetOrElse(List, Supplier)but returns a primitive int. The config's value must be aNumberor null or nonexistant. -
getLong
Likeget(String)but returns a primitive long. The config's value must be aNumber. -
getLong
-
getOptionalLong
LikegetOptional(String)but returns a primitive long. The config's value must be aNumberor null or nonexistant. -
getOptionalLong
LikegetOptional(List)but returns a primitive long. The config's value must be aNumberor null or nonexistant. -
getLongOrElse
LikegetOrElse(String, Object)but returns a primitive long. The config's value must be aNumberor null or nonexistant. -
getLongOrElse
LikegetOrElse(List, Object)but returns a primitive long. The config's value must be aNumberor null or nonexistant. -
getLongOrElse
LikegetOrElse(String, Supplier)but returns a primitive long. The config's value must be aNumberor null or nonexistant. -
getLongOrElse
LikegetOrElse(List, Supplier)but returns a primitive long. The config's value must be aNumberor null or nonexistant. -
getByte
-
getByte
-
getByteOrElse
-
getByteOrElse
-
getShort
-
getShort
-
getShortOrElse
-
getShortOrElse
-
getChar
Returns a char value from the configuration.If the value is a Number, returns
Number.intValue(), cast to char. If the value is a CharSequence, returns its first character. Otherwise, attempts to cast the value to a char.- Parameters:
path- the value's path as a dot-separated String- Returns:
- the value, as a single char
-
getChar
Returns a char value from the configuration.If the value is a Number, returns
Number.intValue(), cast to char. If the value is a CharSequence, returns its first character. Otherwise, attempts to cast the value to a char.- Parameters:
path- the value's path as a list of String- Returns:
- the value, as a single char
-
getCharOrElse
Returns a char value from the configuration.If the value is nonexistant, returns defaultValue. If the value is a Number, returns
Number.intValue(), cast to char. If the value is a CharSequence, returns its first character. Otherwise, attempts to cast the value to a char.- Parameters:
path- the value's pathdefaultValue- the char to return if the value doesn't exist in the config- Returns:
- the value, as a single char
-
getCharOrElse
Returns a char value from the configuration.If the value is nonexistant, returns defaultValue. If the value is a Number, returns
Number.intValue(), cast to char. If the value is a CharSequence, returns its first character. Otherwise, attempts to cast the value to a char.- Parameters:
path- the value's pathdefaultValue- the char to return if the value doesn't exist in the config- Returns:
- the value, as a single char
-
contains
Checks if the config contains a value at some path.- Parameters:
path- the path to check, each part separated by a dot. Example "a.b.c"- Returns:
trueif the path is associated with a value,falseif it's not.
-
contains
Checks if the config contains a value at some path.- Parameters:
path- the path to check, each element of the list is a different part of the path.- Returns:
trueif the path is associated with a value,falseif it's not.
-
isNull
Checks if the config contains a null value at some path.- Parameters:
path- the path to check, each part separated by a dot. Example "a.b.c"- Returns:
trueif the path is associated withNullObject.NULL_OBJECT,falseif it's associated with another value or with no value.
-
isNull
Checks if the config contains a null value at some path.- Parameters:
path- the path to check, each element of the list is a different part of the path.- Returns:
trueif the path is associated withNullObject.NULL_OBJECT,falseif it's associated with another value or with no value.
-
size
int size()Gets the size of the config.- Returns:
- the number of top-level elements in the config.
-
isEmpty
default boolean isEmpty()Checks if the config is empty.- Returns:
trueif the config is empty,falseif it contains at least one element.
-
valueMap
Returns a Map view of the config's values. If the config is unmodifiable then the returned map is unmodifiable too.- Returns:
- a Map view of the config's values.
-
entrySet
Set<? extends UnmodifiableConfig.Entry> entrySet()Returns a Set view of the config's entries. If the config is unmodifiable then the returned set is unmodifiable too.- Returns:
- a Set view of the config's entries.
-
configFormat
ConfigFormat<?> configFormat()Returns the config's format.- Returns:
- the config's format
-
apply
For scala: gets a config value.- Type Parameters:
T- the value's type- Parameters:
path- the value's path, each part separated by a dot. Example "a.b.c"- See Also:
-
apply
For scala: gets a config value.- Type Parameters:
T- the value's type- Parameters:
path- the value's path, each element of the list is a different part of the path.- See Also:
-