EnvironmentParser class abstract

Base interface for parsing configuration files into environment data.

Environment parsers extract configuration properties from various file formats and return them as ParsedEnvironmentSource tuples containing the profile name and properties map.

Unlike regular parsers that work with raw content, environment parsers:

  • Extract profile information from file names or content
  • Return structured data ready for environment loading
  • Work with Asset objects containing file content

Example

class MyEnvironmentParser extends EnvironmentParser {
  @override
  bool canParse(Asset asset) => asset.fileName.endsWith('.myformat');
  
  @override
  EnvironmentLoadedData parse(Asset asset) {
    final profile = extractProfileFromFileName(asset.fileName);
    final properties = parseContent(asset.getContentAsString());
    return (profile, properties);
  }
}
Inheritance
Implementers

Constructors

EnvironmentParser()

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

canParse(Asset asset) bool
Returns true if this parser can handle the given asset.
extractProfileFromFileName(String fileName) String
Extracts profile name from a file name.
load(Asset asset) → ParsedEnvironmentSource
Parses the asset and returns environment data.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
parse(String source) Map<String, dynamic>
Parses the given source string into a Map<String, dynamic>.
inherited
parseAs(Asset asset) Object
Parses the given Asset and returns it as a generic Object.
inherited
parseAsset(Asset asset) Map<String, dynamic>
Parses a Jetleaf Asset into a Map<String, dynamic>.
inherited
parseFile(String path) Map<String, dynamic>
Optionally parses configuration directly from a file located at path.
inherited
toString() String
A string representation of this object.
inherited

Operators

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