property library
π Jetleaf Property Source & Resolution Subsystem
This library provides low-level abstractions for property sources, mutable hierarchies, and property resolver pipelines in Jetleaf applications.
Key capabilities:
- Pluggable Property Sources: Extensible abstraction wrapping maps, system environment, or files.
- Ordered Mutability: Insert sources at specific precedence positions (
addFirst,addLast,addBefore,addAfter). - Type-Safe Value Resolution: Resolving values with type converters and placeholder substitution.
ποΈ Property Hierarchy Pipeline
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β MutablePropertySources β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β [First] Command-Line Flags (highest precedence) β
β β β
β βΌ β
β [Middle] Custom Application Map (override source) β
β β β
β βΌ β
β [Last] System Defaults (lowest fallback) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π¦ Exports Categorization
ποΈ Property Sources
- PropertySource β base class holding a named key-value source of properties.
- MapPropertySource β property source backed by an in-memory Dart
Map<String, Object>. - SystemEnvironmentPropertySource β property source exposing OS system environment variables.
- CompositePropertySource β composite source aggregating multiple nested property sources.
- MutablePropertySources β ordered collection of property sources supporting precedence mutation.
π Resolvers
- PropertyResolver β contract for querying properties and resolving placeholders.
- PropertySourcesPropertyResolver β resolver implementation delegating to PropertySources.
π― Usage Example: Mutable Property Ordering & Resolving
import 'package:jetleaf_core/property.dart';
import 'package:jetleaf_core/lang.dart';
void main() {
final sources = MutablePropertySources();
// Add default fallback properties
sources.addLast(MapPropertySource('defaults', {
'app.name': 'Jetleaf Base',
'app.port': 3000,
}));
// Add high-priority override properties
sources.addFirst(MapPropertySource('overrides', {
'app.port': 8080,
}));
final resolver = PropertySourcesPropertyResolver(sources);
final appName = resolver.getProperty('app.name');
final port = resolver.getPropertyAs<int>('app.port', Class<int>());
print('$appName running on port: $port');
// Output: Jetleaf Base running on port: 8080
}
Classes
- AbstractPropertyResolver
- An abstract base implementation of ConfigurablePropertyResolver that provides common functionality for resolving property placeholders, type conversion, and required property validation.
- AlphabeticalRule
- A property source ordering rule that sorts sources alphabetically by name.
- ApplicationConfigurationProperties
-
ConfigurationProperties is a class for defining application configuration in a typed and expressive way,
similar to defining settings in
application.yaml, but directly in Dart. - ApplicationConfigurationProperty
- A base class for defining structured and strongly typed configuration classes in the Jetleaf framework.
- BeforeRule
- Represents a reordering rule for property sources that ensures one source appears before another within a list of PropertySources.
-
CommandLinePropertySource<
T> - A base class for property sources that are backed by command line arguments.
- ComparatorRule
- A property source ordering rule that sorts sources using a custom OrderComparator.
- CompositePropertySource
- A composite implementation of ListablePropertySource that aggregates multiple PropertySource instances.
- ConfigurablePropertyResolver
- A specialized PropertyResolver that allows full control over property placeholder behavior and type conversion logic using a configurable ConfigurableConversionService.
- JetleafProperty
- Base class for all Jetleaf framework configuration properties.
-
ListablePropertySource<
T> - A specialized PropertySource capable of enumerating all available property keys, allowing efficient lookup operations.
- MapPropertySource
- A PropertySource implementation backed by a Map of key-value pairs.
- MutablePropertySources
- A mutable container for managing an ordered list of PropertySource objects.
- PriorityRule
- A reordering rule for property sources based on explicit numeric priorities.
- PropertyResolver
- A service abstraction for resolving application properties and configuration values.
-
PropertySource<
T> - A base abstraction representing a source of key-value properties, such as maps, environment variables, or configuration files.
- PropertySourceOrderRule
-
Defines a user-supplied rule that determines the ordering of
`PropertySource`objects within Jetleafβs configuration system. - PropertySources
- A collection of PropertySources that provides lookup and stream support.
- PropertySourcesPropertyResolver
- A concrete implementation of AbstractPropertyResolver that retrieves property values from a collection of PropertySources managed by a MutablePropertySources container.
- SimpleCommandLinePropertySource
-
A CommandLinePropertySource that adapts
CommandLineArgsinto a resolvable PropertySource. - SystemEnvironmentPropertySource
- A MapPropertySource that exposes system environment variables as a property source.
Properties
-
environmentLoggingListener
β Obs<
Map< LogLevel, String> > -
A reactive listener that holds environment-specific logging configuration.
final