AbstractPropertyResolver constructor

AbstractPropertyResolver()

An abstract base implementation of ConfigurablePropertyResolver that provides common functionality for resolving property placeholders, type conversion, and required property validation.

This class centralizes configuration for:

  • Placeholder syntax (prefix, suffix, and value separators).
  • Escape characters for literal placeholders.
  • Integration with a ConfigurableConversionService for type-safe conversions.

Subclasses are expected to implement:

  • getProperty → Retrieve a property value as a string or typed object.
  • containsProperty → Check whether a property key exists.
  • Any additional accessors required for property resolution.

Responsibilities

  • Resolving nested placeholders in property values.
  • Delegating conversion to the active ConversionService.
  • Handling both optional and required property lookups.
  • Providing hooks for ignoring or enforcing unresolvable placeholders.

Example

class EnvPropertyResolver extends AbstractPropertyResolver {
  final Map<String, String> _env;

  EnvPropertyResolver(this._env);

  @override
  String? getProperty(String key) => _env[key];

  @override
  bool containsProperty(String key) => _env.containsKey(key);
}

void main() {
  final resolver = EnvPropertyResolver({'app.name': 'JetLeaf'});
  final value = resolver.resolveNestedPlaceholders('Welcome to \${app.name}');
  print(value); // "Welcome to JetLeaf"
}

Implementation

AbstractPropertyResolver();