# AbstractEnvironment class abstract

Base class for creating environment implementations in JetLeaf.

`AbstractEnvironment` is a foundational implementation of ConfigurableEnvironment that manages environment properties and profiles via:

- A `MutablePropertySources` collection,
- A `PropertySourcesPropertyResolver` for resolving properties,
- A ConfigurableConversionService for type conversions,
- and support for placeholder resolution and profile activation.

Subclasses should override customizePropertySources to register their own sources, such as system properties, application config maps, or custom sources.

### Example

    class MyEnvironment extends AbstractEnvironment {
      @override
      void customizePropertySources(MutablePropertySources sources) {
        sources.addLast(MapPropertySource('my-config', {
          'server.port': '8080',
          'debug': 'true',
        }));
      }
    }

    void main() {
      final env = MyEnvironment();
      print(env.getProperty('server.port')); // 8080
    }

### Profiles

JetLeaf supports both active and default profiles:

- Active profiles are those explicitly set using setActiveProfiles or addActiveProfile.
- Default profiles are used when no active profile is set, and can be configured using setDefaultProfiles.

A default profile name of `"default"` is always used unless overridden.

### System properties and environment

You can access system properties and environment variables using getSystemProperties and getSystemEnvironment. To suppress access to `System.getenv()`, set the `jetleaf.getenv.ignore` flag via `JetLeafProperties`.

Inheritance
  - Object
  - Environment
  - ConfigurableEnvironment
  - AbstractEnvironment

## Constructors

AbstractEnvironment.new()
  Base class for creating environment implementations in JetLeaf.
AbstractEnvironment.source(MutablePropertySources propertySources)
  Constructor with Pre-Created Sources

## Properties

hashCode → int
  The hash code for this object.
  no setter inherited
runtimeType → Type
  A representation of the runtime type of the object.
  no setter inherited

## Methods

acceptsProfiles(Profiles profiles) → bool
  Profile Predicate Evaluation
  override
addActiveProfile(String profile) → void
  Adds an additional active profile to the current set.
  override
containsProperty(String key) → bool
  Returns whether the given property `key` is defined.
createPropertyResolver(MutablePropertySources propertySources) → ConfigurablePropertyResolver
  Factory for Property Resolver
customizePropertySources(MutablePropertySources sources) → void
  Called during construction to allow subclasses to register default property sources.
doGetActiveProfiles() → Set<String>
  Resolves Active Profiles
doGetActiveProfilesProperty() → String?
  Reads Active Profiles Property
doGetDefaultProfiles() → Set<String>
  Resolves Default Profiles
doGetDefaultProfilesProperty() → String?
  Reads Default Profiles Property
getActiveProfiles() → List<String>
  Active Profiles
  override
getConversionService() → ConfigurableConversionService
  Returns the ConfigurableConversionService used to perform type conversions.
getDefaultProfiles() → List<String>
  Default Profiles
  override
getPackageName() → String
  Represents an abstraction for identifying the package that an object, resource, or service belongs to.
  inherited
getProperty(String key, [String? defaultValue]) → String?
  Retrieves the value for the given property `key`, or `null` if not found.
getPropertyAs<T>(String key, Class<T> targetType, [T? defaultValue]) → T?
  Retrieves and converts the value of `key` to the desired type `T`.
getPropertyResolver() → ConfigurablePropertyResolver
  Access to the Property Resolver
getPropertySources() → MutablePropertySources
  Returns the `MutablePropertySources` backing this environment.
  override
getRequiredProperty(String key) → String
  Returns the property value for `key`, or throws IllegalStateException if the property is not defined.
getRequiredPropertyAs<T>(String key, Class<T> targetType) → T
  Retrieves and converts the property `key` to type `T`, or throws IllegalStateException if missing or invalid.
getReservedDefaultProfiles() → Set<String>
  Reserved Default Profiles
getSystemEnvironment() → Map<String, String>
  Returns the environment variables of the underlying OS.
  override
getSystemProperties() → Map<String, String>
  Returns the system properties available to the Dart VM (if any), such as those passed via `--define` or custom bootstrap logic.
  override
isProfileActive(String profile) → bool
  Checks Profile Activation
matchesProfiles(List<String> profileExpressions) → bool
  Profile Expression Matcher
  inherited
merge(ConfigurableEnvironment parent) → void
  Merges another ConfigurableEnvironment into this one.
  override
noSuchMethod(Invocation invocation) → dynamic
  Invoked when a nonexistent method or property is accessed.
  inherited
resolvePlaceholders(String text) → String
  Resolves `#{...}` placeholders in the input `text` using available properties.
resolveRequiredPlaceholders(String text) → String
  Resolves `#{...}` placeholders in the input `text` using available properties.
setActiveProfiles(List<String> profiles) → void
  Replaces the current set of active profiles with the given list.
  override
setConversionService(ConfigurableConversionService conversionService) → void
  Replaces the underlying ConfigurableConversionService used for type conversions.
setDefaultProfiles(List<String> profiles) → void
  Specify the set of profiles to be made active by default if no other profiles are explicitly made active through {@link #setActiveProfiles}.
  override
setEscapeCharacter(Character? escapeCharacter) → void
  Sets the escape character used to ignore placeholder prefix and separator.
setIgnoreUnresolvableNestedPlaceholders(bool ignoreUnresolvableNestedPlaceholders) → void
  Enables or disables ignoring unresolvable nested placeholders.
setPlaceholderPrefix(String placeholderPrefix) → void
  Sets the prefix that identifies a placeholder in property values.
setPlaceholderSuffix(String placeholderSuffix) → void
  Sets the suffix that identifies the end of a placeholder in property values.
setRequiredProperties(List<String> requiredProperties) → void
  Sets the list of property names that are required to be present and non-null.
setValueSeparator(String? valueSeparator) → void
  Sets the separator for default values within placeholders.
suggestions(String key) → List<String>
  Configuration Suggestions
  override
suppressGetenvAccess() → bool
  Suppresses System Environment Access
toString() → String
  A string representation of this object.
  override
validateProfile(String profile) → void
  Profile Name Validation
validateRequiredProperties() → void
  Validates that all required properties are present and non-null.

## Operators

operator ==(Object other) → bool
  The equality operator.
  inherited

## Static Properties

ACTIVE_PROFILES_PROPERTY_NAME → String
  Active Profiles Property
  final
DEFAULT_PROFILES_PROPERTY_NAME → String
  Default Profiles Property
  final
IGNORE_GETENV_PROPERTY_NAME → String
  System Environment Suppression Flag
  final
RESERVED_DEFAULT_PROFILE_NAME → String
  Reserved Default Profile Name
  final