ConfigMap class
Represents a config item with keys and values.
Create a config map by passing in config text to the constructor. Config maps can also be obtained by extracting it from an existing config map using one of the map extraction methods.
Extracting values
Values can be extracted by passing the name of the key to the extraction methods.
Extraction methods for mandatory scalar values:
Extraction methods for optional scalar values (returns null if the key does not exist):
Extraction methods for lists of scalars (by default empty lists are permitted):
Extraction methods for optional lists of scalars:
Values which are config maps, or lists of config maps, are extracted using:
Identifying unexpected keys
After using the extraction methods, the unusedKeysCheck method can be used to check for keys which have not been extracted, which is usually identifies an invalid config.
Alternatively, the permitted keys can be passed to the keys method.
Dynamic processing
A list of all the keys can be obtained with the keys method and their value identified with the type method.
Properties
Methods
-
boolean(
String key, {bool? defaultValue}) → bool - Extracts a boolean value.
-
booleanOptional(
String key) → bool? - Extracts an optional boolean value.
-
booleans(
String key, {bool allowEmptyList = true}) → List< bool> - Extracts a list of booleans.
-
booleansOptional(
String key, {int? min, int? max, bool allowEmptyList = true}) → List< bool> ? - Extracts an optional list of booleans.
-
integer(
String key, {int? defaultValue, int? min, int? max}) → int - Extracts an integer value.
-
integerOptional(
String key, {int? min, int? max}) → int? - Extracts an optional integer value.
-
integers(
String key, {int? min, int? max, bool allowEmptyList = true}) → List< int> - Extracts a list of integers.
-
integersOptional(
String key, {int? min, int? max, bool allowEmptyList = true}) → List< int> ? - Extracts an optional list of integers.
-
keys(
{List< String> ? permitted}) → List<String> - List all the keys in the config map.
-
map(
String key) → ConfigMap - Extracts a config map.
-
mapOptional(
String key) → ConfigMap? - Extracts an optional boolean value.
-
maps(
String key, {bool allowEmptyList = true}) → List< ConfigMap> - Extracts a list of config maps.
-
mapsOptional(
String key, {bool allowEmptyList = true}) → List< ConfigMap> ? - Extracts an optional list of config maps.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
string(
String key, {bool keepWhitespace = false, bool allowEmpty = false, bool allowBlank = false, Iterable< String> ? permitted, String? defaultValue}) → String - Extracts a string value.
-
stringOptional(
String key, {bool keepWhitespace = false, bool allowEmpty = false, bool allowBlank = false, Iterable< String> ? permitted}) → String? - Extracts an optional string value.
-
strings(
String key, {bool allowEmptyList = true, bool keepWhitespace = false, bool allowEmpty = false, bool allowBlank = false, Iterable< String> ? permitted}) → List<String> - Extracts a list of strings.
-
stringsOptional(
String key, {bool allowEmptyList = true, bool keepWhitespace = false, bool allowEmpty = false, bool allowBlank = false, Iterable< String> ? permitted}) → List<String> ? - Extracts an optional list of strings.
-
toString(
) → String -
A string representation of this object.
inherited
-
type(
String key) → ConfigType - Identifies the type of a key's value.
-
unusedKeysCheck(
) → void - Checks all the keys in the config map have been processed.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited