Converters
Last updated
Last updated
Converters are first level serializers which convert an unserialized value into to a graph representation. Custom converter implementations can be linked via @LinkSerializer()
. By default, all converters are associated with their type argument. This behaviour can be disabled by specifying isAssociated
in the super constructor.
Converters must only be able to serialize single instances. Common collections will be automatically handled by the DOG engine.
Following converters are registered by default. (Primitive types can be converted without the need for a converter)
PolymorphicConverter
dynamic, Object (not associated)
DefaultIterableConverter
Iterable<dynamic> (not associated)
DefaultListConverter
List<dynamic> (not associated)
DefaultSetConverter
Set<dynamic> (not associated)
DefaultMapConverter
Map<dynamic,dynamic> (not associated)
DateTimeConverter
DurationConverter
UriConverter
Uint8List
Dog supports first level polymorphism for all data types which are either primitive or have a registered Structures. Complex types are identified by a added _type
property in the resulting DogMap. Complex types which are serialized to a graph value which is not a map are expanded into a map containing the type in _type
and the converted value in _value
. Properties can be marked as polymorphic by tagging the fields with @Polymorphic()
.