AbstractAwareObjectMapper class abstract

An enhanced, application-aware Jetson object mapper that integrates seamlessly with the JetLeaf dependency injection, environment system, and conversion infrastructure.

AbstractAwareObjectMapper extends AbstractYamlObjectMapper with awareness of:

  • ApplicationContext – used to discover and register serializers, deserializers, adapters, naming strategies, and generator implementations.
  • ConversionService – automatically injected unless explicitly set, enabling cross-type conversions during serialization and deserialization.
  • Environment – provides access to configuration properties and environment variables, injected from the application context if not manually provided.
  • Pod lifecycle – implements InitializingPod, allowing it to register Jetson components during startup.
  • Context-aware generators – automatically configures JSON, XML, and YAML generators if they exist in the application context.

🔧 Responsibilities

This mapper acts as a fully-managed, dependency-aware object mapper inside the JetLeaf ecosystem. During application bootstrap it:

  1. Discovers all registered:
  2. Orders them using JetLeaf’s annotation-based ordering system.
  3. Registers them into the mapper.
  4. Automatically wires available generators:
  5. Applies discovered:
  6. Lazily initializes or injects:
    • ConversionService
    • Environment

🔁 Initialization Lifecycle

When JetLeaf constructs this mapper:

  1. ApplicationContext is injected via setApplicationContext.
  2. If not manually set:
    • The mapper receives the application’s global ConversionService.
    • The mapper inherits the global Environment.
  3. On onReady():
    • All mappers, adapters, contexts, generators, and strategies are registered in a deterministic order.

🌱 Conversion & Environment Awareness

The mapper behaves gracefully if specific components are not available:

  • If no ConversionService is injected, it falls back to a SimpleConversionService.
  • If no Environment is injected, it defaults to the global GlobalEnvironment.

You may override either manually:

mapper.setEnvironment(myEnvironment);
mapper.setConversionService(myConversionService);

🧩 Extending This Class

Custom JetLeaf modules typically extend this mapper to preconfigure serialization behavior, add custom adapters, or override Jetson settings.

Example:

class MyAppObjectMapper extends AbstractAwareObjectMapper {
  MyAppObjectMapper() {
    // Additional configuration here
  }
}

📦 Package Integration

This mapper resides in the web package space and acts as the underlying mapper powering JetLeaf’s HTTP message converters (JSON, XML, YAML).

Inheritance
Implementers

Constructors

AbstractAwareObjectMapper([bool autoRegisterStandardAdapters = true])
An enhanced, application-aware Jetson object mapper that integrates seamlessly with the JetLeaf dependency injection, environment system, and conversion infrastructure.

Properties

autoRegisterStandardAdapters bool
Whether to auto add default adapters on instantiation
getter/setter pairinherited
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

disableFeature(String featureName) → void
Disables a configurable feature flag.
inherited
enableFeature(String featureName) → void
Enables a configurable feature flag within the mapping engine.
inherited
getConversionService() → ConversionService
Returns the global ConversionService responsible for type coercions and primitive value conversions.
override
getEnvironment() → Environment
Returns the active Environment configuration associated with this mapper.
override
getJsonDeserializationContext() JsonDeserializationContext
Returns the active JsonDeserializationContext, creating it if necessary.
inherited
getJsonGenerator() JsonGenerator
Returns the active JsonGenerator, initializing it lazily if necessary.
inherited
getJsonParser(String content) JsonParser
Returns a JsonParser for the given JSON content.
inherited
getJsonSerializationContext() JsonSerializationContext
Returns the active JsonSerializationContext, creating it lazily when needed.
inherited
getNamingStrategy() NamingStrategy
Returns the naming strategy used for field name conversion.
inherited
getPackageName() String
Represents an abstraction for identifying the package that an object, resource, or service belongs to.
getXmlDeserializationContext() XmlDeserializationContext
Returns the active XmlDeserializationContext, creating it lazily if necessary.
inherited
getXmlGenerator() XmlGenerator
Returns the active XmlGenerator, creating one if necessary.
inherited
getXmlParser(String content) XmlParser
Creates and returns a new XmlParser for the provided XML content string.
inherited
getXmlSerializationContext() XmlSerializationContext
Returns the active XmlSerializationContext, creating it lazily if needed.
inherited
getYamlDeserializationContext() YamlDeserializationContext
Returns the current YamlDeserializationContext, creating it if needed.
inherited
getYamlGenerator() YamlGenerator
Returns the active YamlGenerator, creating one if needed.
inherited
getYamlParser(String content) YamlParser
Creates a new YamlParser for the given YAML content string.
inherited
getYamlSerializationContext() YamlSerializationContext
Returns the current YamlSerializationContext, creating it if necessary.
inherited
isFeatureEnabled(String featureName) bool
Returns whether a feature flag is currently enabled.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onReady() Future<void>
Interface to be implemented by pods that require initialization logic after their properties have been set by the container.
readContentTree(String content) JsonNode
Parses the given JSON content string into a JsonNode tree.
inherited
readJsonValue<T>(String json, Class<T> type) → T
Deserializes a structured json string into an object of type T.
inherited
readJsonValueFromMap<T>(Map<String, dynamic> map, Class<T> type) → T
Deserializes a pre-parsed map into an object of type T.
inherited
readTree(JsonParser parser) JsonNode
Reads and parses JSON content from the given JsonParser into a JsonNode tree.
inherited
readValue<T>(String data, Class<T> type, [ObjectMapperType mapWith = ObjectMapperType.JSON]) → T
Deserializes a structured string into an object of type T.
inherited
readValueFromMap<T>(Map<String, dynamic> map, Class<T> type, [ObjectMapperType mapWith = ObjectMapperType.JSON]) → T
Deserializes a pre-parsed map into an object of type T.
inherited
readXmlContentTree(String content) XmlNode
Parses the given XML content string into an XmlNode tree.
inherited
readXmlTree(XmlParser parser) XmlNode
Reads and parses XML content from the given XmlParser into an XmlNode tree.
inherited
readXmlValue<T>(String xml, Class<T> type) → T
Deserializes an XML string into an object of type T.
inherited
readXmlValueFromMap<T>(Map<String, dynamic> map, Class<T> type) → T
Deserializes an XML-compatible map into an instance of type T.
inherited
readYamlContentTree(String content) YamlNode
Parses the given YAML content string into a YamlNode tree.
inherited
readYamlTree(YamlParser parser) YamlNode
Reads and parses YAML content from the given YamlParser into a YamlNode tree.
inherited
readYamlValue<T>(String yaml, Class<T> type) → T
Deserializes a YAML string into an object of type T.
inherited
readYamlValueFromMap<T>(Map<String, dynamic> map, Class<T> type) → T
Deserializes a YAML-compatible map into an instance of type T.
inherited
registerAdapter(Class type, ObjectSerializationAdapter<dynamic, Generator, Parser, DeserializationContext<Parser>, SerializationContext<Generator>> adapter) → void
Registers a bidirectional adapter (ObjectSerializationAdapter) for type T.
inherited
registerDeserializer(Class type, ObjectDeserializer<dynamic, Parser, DeserializationContext<Parser>> deserializer) → void
Registers a custom deserializer for type T.
inherited
registerSerializer(Class type, ObjectSerializer<dynamic, Generator, SerializationContext<Generator>> serializer) → void
Registers a custom serializer for type T.
inherited
setApplicationContext(ApplicationContext applicationContext) → void
Sets the ApplicationContext that this component runs in.
setConversionService(ConversionService conversionService) → void
Sets the ConversionService that this component can use for type conversions.
setDeserializationContext(DeserializationContext<Parser> context) → void
Assigns the DeserializationContext used during deserialization.
inherited
setEnvironment(Environment environment) → void
Sets the Environment that this component runs in.
setJsonGenerator(JsonGenerator jsonGenerator) → void
Sets the active JsonGenerator used for serializing Dart objects to JSON.
inherited
setJsonParserFactory(JsonParserFactory factory) → void
Sets a custom JSON parser factory to create JsonParser instances from raw JSON strings.
inherited
setNamingStrategy(NamingStrategy strategy) → void
Sets the active NamingStrategy for this mapper.
inherited
setSerializationContext(SerializationContext<Generator> context) → void
Assigns the SerializationContext used during serialization.
inherited
setXmlGenerator(XmlGenerator generator) → void
Sets the active XmlGenerator used for serializing Dart objects to XML.
inherited
setYamlGenerator(YamlGenerator generator) → void
Sets the active YamlGenerator used for serializing Dart objects to YAML.
inherited
toString() String
A string representation of this object.
inherited
writeValueAsJson(Object? value) String
Serializes a Dart object into a JSON string.
inherited
writeValueAsJsonMap(Object? value) Map<String, dynamic>
Serializes a Dart object into a Map<String, dynamic> representation.
inherited
writeValueAsMap(Object? value, [ObjectMapperType mapWith = ObjectMapperType.JSON]) Map<String, dynamic>
Serializes a Dart object into a Map<String, dynamic> representation.
inherited
writeValueAsString(Object? value, [ObjectMapperType mapWith = ObjectMapperType.JSON]) String
Serializes a Dart object into a structured format string.
inherited
writeValueAsXml(Object? value) String
Serializes a Dart object into an XML string.
inherited
writeValueAsXmlMap(Object? value) Map<String, dynamic>
Serializes a Dart object into an XML Map<String, dynamic> representation.
inherited
writeValueAsYaml(Object? value) String
Serializes a Dart object into a YAML string.
inherited
writeValueAsYamlMap(Object? value) Map<String, dynamic>
Serializes a Dart object into a YAML Map<String, dynamic> representation.
inherited

Operators

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