MapPropertySource class
A PropertySource implementation backed by a Map of key-value pairs.
This class allows accessing properties from an in-memory map, making it suitable for programmatically defined configurations such as application defaults, test configurations, or runtime-supplied settings.
It supports property lookup via containsProperty and getProperty.
Example usage:
final config = {
'app.name': 'JetLeaf',
'app.port': 8080,
};
final propertySource = MapPropertySource('defaultConfig', config);
print(propertySource.containsProperty('app.name')); // true
print(propertySource.getProperty('app.port')); // 8080
This can be added to a MutablePropertySources collection for use with a PropertySourcesPropertyResolver.
- Inheritance
-
- Object
- PropertySource<
Map< String, Object> > - MapPropertySource
- Implementers
Constructors
-
MapPropertySource(String name, Map<
String, Object> source) - A PropertySource implementation backed by a Map of key-value pairs.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
containsProperty(
String name) → bool -
Returns
trueif this property source contains a value for the given propertyname.override -
equalizedProperties(
) → List< Object?> -
Mixin-style contract for value-based equality,
hashCode, andtoString.inherited -
getName(
) → String -
Returns the unique, human-readable name of this property source.
inherited
-
getProperty(
String name) → Object? -
Retrieves the value associated with the given property
name, ornullif the property is not present in this source.override -
getSource(
) → Map< String, Object> -
Returns the underlying source object from which property data is retrieved.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited