Object Graph

DOGs creates a intermediate graph representation of the serialized object as common interpretation. This graph consists of DogGraphValue nodes which include:

  • DogString

  • DogInt

  • DogDouble

  • DogBool

  • DogNull

  • DogList

  • DogList

  • DogNative

Serializers from a user-perspective are called "Converters" in DOGs, as they must only be able to convert the object into the graph representation, rather than fully serializing it. The final serializer then just converters this intermediate representation into a portable format.

Each graph node provides following api methods to interact with it and its descendents:

  • coerceString() to convert the subtree into a String representation.

  • coerceNative() to convert the subtree into a primitive value. Primitive refers to a object, that is serializable by jsonEncode() without any changes.

  • clone() to get a cloned copy of the graph value.

  • accept() to accept DogVisitors.

All primitive values, as explained previously, can also be converted to a graph representation by using the native codec of the dog engine.

Last updated