SubsetConfiguration class
A subset of another configuration. The new Configuration object contains every key from the parent Configuration that starts with prefix. The prefix is removed from the keys in the subset.
- Inheritance
-
- Object
- Configuration
- SubsetConfiguration
Constructors
- SubsetConfiguration.fromConfiguration(Configuration config, String aprefix, [String? delimiter])
-
Create a SubsetConfiguration using the given config as parent and the given prefix.
factory
Properties
- delimiter ↔ String
-
The prefix delimiter.
getter/setter pair
- delimiterParsingDisabled ↔ bool
-
Returns true if the given configuration delimiter will not be used
while parsing for this configuration, false otherwise.
getter/setter pairoverride
- getInterpolator → ConfigurationInterpolator
-
Returns the
ConfigurationInterpolatorobject that manages the lookup objects for resolving variables.no setterinherited - getSubstitutor → StrSubstitutor
-
Returns the object that is responsible for variable interpolation.
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- listDelimiter ↔ String
-
Returns the delimiter used to convert single values to lists.
getter/setter pairoverride
- parent ↔ Configuration
-
The parent configuration.
getter/setter pair
- prefix ↔ String
-
The prefix used to select the properties.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- throwExceptionOnMissing ↔ bool
-
Returns true if the configuration should throw exceptions or simply
return null when a property does not exist.
getter/setter pairoverride
Methods
-
addProperty(
String key, Object value) → void -
Add a property to the configuration. If it already exists then the value
inherited
-
addPropertyDirect(
String key, Object value) → void -
Adds a key/value pair to the Configuration. Override this method to
provide write access to underlying Configuration store.
override
-
addPropertyValues(
String key, Object? value, String delimiter) → void -
Adds the specified value for the given property. This method supports
single values and containers (e.g. Iterable) as well. In the
latter case,
addPropertyDirect()will be called for each element.inherited -
append(
Configuration c) → void -
Appends the content of the specified configuration to this configuration.
The values of all properties contained in the specified configuration
will be appended to this configuration. So if a property is already
present in this configuration, its new value will be a union of the
values in both configurations.
inherited
-
clear(
) → void -
Remove all properties from the configuration.
inherited
-
clearProperty(
String key) → void -
Removes the specified property from this configuration. This
implementation performs some preparations and then delegates to
clearPropertyDirect(), which will do the real work.inherited -
clearPropertyDirect(
String key) → void -
Removes the specified property from this configuration. This method is
called by
clearProperty()after it has done some preparations. It should be overridden in sub classes.override -
clone(
) → Configuration -
Clone this configuration as appropriate.
override
-
containsKey(
String key) → bool -
Check if the configuration contains the specified key.
override
-
copy(
Configuration config) → void -
Copies the content of the given configuration into this
configuration. If the specified configuration contains a key that is also
present in this configuration, the value of this key will be replaced by
the new value.
Note: Subclasses should override this method as and where
appropriate, eg HierarchicalConfiguration
inherited
-
getBigInt(
String key, [BigInt? defaultValue]) → BigInt -
Get a BigInt associated with the given configuration key.
If the key doesn't map to an existing object, the default value
is returned.
If no default value is provided and throwExceptionOnMissing is true
then a
NoSuchElementExceptionis thrown. If throwExceptionOnMissing is false thenBigInt.zerois returned. If the value exists then interpolation is performed before returning it. The returned BigInt is never null. Throws ConversionException if the value cannot be converted to BigInt.inherited -
getBool(
String key, [bool? defaultValue]) → bool -
Get a bool associated with the given configuration key.
If the key doesn't map to an existing object, the default value
is returned.
If no default value is provided and throwExceptionOnMissing is true
then a
NoSuchElementExceptionis thrown. If throwExceptionOnMissing is false thenfalseis returned. If the value exists then interpolation is performed before returning it. The returned bool is never null. Throws ConversionException if the value cannot be converted to bool.inherited -
getChildKey(
String key) → String - Return the key in the subset configuration associated to the specified key in the parent configuration.
-
getDateTime(
String key, [DateTime? defaultValue]) → DateTime -
Get a DateTime associated with the given configuration key.
If the key doesn't map to an existing object, the default value
is returned.
If no default value is provided and throwExceptionOnMissing is true
then a
NoSuchElementExceptionis thrown. If throwExceptionOnMissing is false then the current DateTimeDateTime.now()is returned. If the value exists then interpolation is performed before returning it. The returned DateTime is never null. Throws ConversionException if the value cannot be converted to DateTime.inherited -
getDouble(
String key, [double? defaultValue]) → double -
Get a double associated with the given configuration key.
If the key doesn't map to an existing object, the default value
is returned.
If no default value is provided and throwExceptionOnMissing is true
then a
NoSuchElementExceptionis thrown. If throwExceptionOnMissing is false then0.0is returned. If the value exists then interpolation is performed before returning it. The returned double is never null. Throws ConversionException if the value cannot be converted to double.inherited -
getInt(
String key, [int? defaultValue]) → int -
Get a int associated with the given configuration key.
If the key doesn't map to an existing object, the default value
is returned.
If no default value is provided and throwExceptionOnMissing is true
then a
NoSuchElementExceptionis thrown. If throwExceptionOnMissing is false thenfalseis returned. If the value exists then interpolation is performed before returning it. The returned int is never null. Throws ConversionException if the value cannot be converted to int.inherited -
getKeys(
) → Iterator< String> -
Get the list of the keys contained in the configuration. The returned
iterator can be used to obtain all defined keys.
override
-
getKeysPrefixed(
String pfix) → Iterator< String> -
This implementation returns keys that either match the
prefix or start with the prefix followed by a dot ('.').
override
-
getList(
String key, [List< Object?> ? defaultValue]) → List<Object?> -
Get a List of strings associated with the given configuration key.
If the key doesn't map to an existing object an empty List is returned.
inherited
-
getParentKey(
String? key) → String - Return the key in the parent configuration associated to the specified key in this subset.
-
getProperty(
String? key) → Object? -
Gets a property from the configuration. This is the most basic get
method for retrieving values of properties. In a typical implementation
of the
Configurationinterface the other get methods (that return specific data types) will internally make use of this method. On this level variable substitution is not yet performed. The returned object is an internal representation of the property value for the passed in key. It is owned by theConfigurationobject. So a caller should not modify this object.override -
getString(
String key, [String? defaultValue]) → String -
Get a String associated with the given configuration key.
If the key doesn't map to an existing object, the default value
is returned.
If no default value is provided and throwExceptionOnMissing is true
then a
NoSuchElementExceptionis thrown. If throwExceptionOnMissing is false then an empty String''is returned. If the value exists then interpolation is performed before returning it. The returned String is never null.inherited -
getUri(
String key, [Uri? defaultValue]) → Uri -
Get a Uri associated with the given configuration key.
If the key doesn't map to an existing object, the default value
is returned.
If no default value is provided and throwExceptionOnMissing is true
then a
NoSuchElementExceptionis thrown. If throwExceptionOnMissing is false then an empty Uri (Uri()) is returned. If the value exists then interpolation is performed before returning it. The returned Uri is never null. Throws ConversionException if the value cannot be converted to Uri.inherited -
interpolate(
Object? source) → Object? -
Returns the interpolated value. Non String values are returned without change.
override
-
interpolatedConfiguration(
) → Configuration -
Returns a configuration with the same content as this configuration, but
with all variables replaced by their actual values. This method tries to
clone the configuration and then perform interpolation on all properties.
So property values of the form
${var}will be resolved as far as possible (if a variable cannot be resolved, it remains unchanged). This operation is useful if the content of a configuration is to be exported or processed by an external component that does not support variable interpolation.inherited -
isEmpty(
) → bool -
Check if the configuration is empty.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
setProperty(
String key, Object value) → void -
Set a property, this will replace any previously set values.
inherited
-
subset(
String prefix) → Configuration -
Return a decorator Configuration containing every key from the current
Configuration that starts with the specified prefix. The prefix is
removed from the keys in the subset.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- defaultDelimiter → String
-
final