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

πŸ” Resolvers


🎯 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 CommandLineArgs into 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