AbstractXmlObjectMapper class abstract
Abstract base implementation of XmlObjectMapper providing core XML serialization and deserialization functionality.
This class implements all XmlObjectMapper methods using XML parsing and serialization. Subclasses provide the actual implementation details for parsing XML content and building objects from XML nodes.
Design
- Handles XML serialization and deserialization contract
- Delegates format-specific XML processing to subclasses
- Reuses ObjectMapper methods for JSON operations where applicable
- Provides XML-specific entry points without coupling to implementation
Responsibilities
This class handles:
- XML content parsing and tree traversal
- Tree-based XML navigation via XmlNode
- Format conversions between XML strings and maps
- Integration with Jetson's naming strategies and converters
Extension
Subclasses should override:
- writeValueAsXml - Custom XML serialization
- readXmlValue - Custom XML deserialization
- readXmlTree - XML tree parsing implementation
- Other methods as needed for custom XML processing
Example
class MyXmlMapper extends AbstractXmlObjectMapper {
@override
String writeValueAsXml(Object? value) {
// Custom XML serialization
}
}
Related Classes
- AbstractYamlObjectMapper - YAML extension
- XmlObjectMapper - Interface definition
- ObjectMapper - Base mapping contract
- Inheritance
-
- Object
- AbstractJsonObjectMapper
- AbstractXmlObjectMapper
- Implemented types
- Implementers
Constructors
- AbstractXmlObjectMapper([bool autoRegisterStandardAdapters = true])
- Abstract base implementation of XmlObjectMapper providing core XML serialization and deserialization functionality.
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
ConversionServiceresponsible for type coercions and primitive value conversions.inherited -
getEnvironment(
) → Environment -
Returns the active
Environmentconfiguration associated with this mapper.inherited -
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
-
getXmlDeserializationContext(
) → XmlDeserializationContext - Returns the active XmlDeserializationContext, creating it lazily if necessary.
-
getXmlGenerator(
) → XmlGenerator - Returns the active XmlGenerator, creating one if necessary.
-
getXmlParser(
String content) → XmlParser - Creates and returns a new XmlParser for the provided XML content string.
-
getXmlSerializationContext(
) → XmlSerializationContext - Returns the active XmlSerializationContext, creating it lazily if needed.
-
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
-
readContentTree(
String content) → JsonNode -
Parses the given JSON
contentstring 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
contentstring into an XmlNode tree.override -
readXmlTree(
XmlParser parser) → XmlNode -
Reads and parses XML content from the given XmlParser into an XmlNode tree.
override
-
readXmlValue<
T> (String xml, Class< T> type) → T -
Deserializes an XML string into an object of type
T.override -
readXmlValueFromMap<
T> (Map< String, dynamic> map, Class<T> type) → T -
Deserializes an XML-compatible map into an instance of type
T.override -
registerAdapter(
Class type, ObjectSerializationAdapter< dynamic, Generator, Parser, DeserializationContext< adapter) → voidParser> , SerializationContext<Generator> > -
Registers a bidirectional adapter (
ObjectSerializationAdapter) for typeT.override -
registerDeserializer(
Class type, ObjectDeserializer< dynamic, Parser, DeserializationContext< deserializer) → voidParser> > -
Registers a custom deserializer for type
T.override -
registerSerializer(
Class type, ObjectSerializer< dynamic, Generator, SerializationContext< serializer) → voidGenerator> > -
Registers a custom serializer for type
T.override -
setDeserializationContext(
DeserializationContext< Parser> context) → void -
Assigns the DeserializationContext used during deserialization.
override
-
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.
override
-
setXmlGenerator(
XmlGenerator generator) → void -
Sets the active XmlGenerator used for serializing Dart objects to XML.
override
-
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.
override
-
writeValueAsXmlMap(
Object? value) → Map< String, dynamic> -
Serializes a Dart object into an XML
Map<String, dynamic>representation.override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited