ListJsonSerializationAdapter class final
Handles serialization and deserialization of List objects in Jetleaf’s JSON subsystem.
The ListJsonSerializationAdapter provides a reflection-aware adapter for
converting JSON arrays into Dart List instances and vice versa.
Core Responsibilities
- Deserialize JSON arrays into strongly-typed Dart
Listobjects. - Serialize Dart
Listobjects into JSON arrays. - Recursively handle nested arrays and objects by delegating to the appropriate deserializers in JsonDeserializationContext.
- Skip null values during deserialization if they appear in the JSON.
- Resolve element types via
componentTypemetadata or runtime type.
Example
final adapter = ListJsonSerializationAdapter();
final parser = JsonParser('[1, 2, 3]');
final list = adapter.deserialize(parser, context, Class.forType(List));
final generator = JsonGenerator();
adapter.serialize(list, generator, serializerContext);
Notes
- Supports primitive, complex, and nested elements.
- Integrates with JsonDeserializationContext and JsonSerializationContext to respect naming strategies and type conversion.
- Works for both generic
List<T>and rawListtypes.
See also
- Inheritance
-
- Object
- JsonSerializationAdapter<
List> - ListJsonSerializationAdapter
Constructors
- ListJsonSerializationAdapter()
-
Creates a constant instance of ListJsonSerializationAdapter.
const
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
-
canDeserialize(
Class type) → bool -
Returns whether the given
typecan be deserialized by the system.override -
canSerialize(
Class type) → bool -
Returns whether the given
typecan be serialized by the system.override -
deserialize(
JsonParser parser, JsonDeserializationContext ctxt, Class toClass) → List? -
Deserializes an object of type
Tusing the givenPand DeserializationContext.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
serialize(
List value, JsonGenerator generator, JsonSerializationContext serializer) → void -
Serializes an object of type
Tinto an object using the provided Generator and SerializationContext.override -
supports(
DeserializationContext< Parser> context) → bool -
Determines whether this deserializer supports the given deserialization context.
inherited
-
supportsContext(
SerializationContext< Generator> context) → bool -
Determines whether this serializer supports the given serialization context.
inherited
-
toClass(
) → Class< List> -
Provides a contract for types capable of exposing their associated
runtime
Classmetadata representation within the Jetleaf reflection system. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited