Structures

Structures are descriptors for complex objects. They contain information about the type that is being described and about the fields it has. They can either be generated via the dogs_generator or manually created. Following information about the class is collected:

  • Serial Name (usually the class name)

  • Structure Conformity (dataclass, basic, bean)

  • Proxy (methods for interacting with object instances)

  • Retained Annotations

Further following information about the fields is being collected:

  • Field Name

  • Field Type

  • Serial Type (type argument of a iterable)

  • Converter Type (optional)

  • Iterable Kind (type of the iterable)

  • (Is)Optional

  • (Is)Structure

  • Retained Annotations

As you might have already seen: The dogs_generator includes copied version of the annotations present on the fields at runtime which allows for easy extensibility of the dogs framework. Validation annotation for example are such a use case.

For polymorphic converters to serialize and deserialize an object, the object must be registered in the engines structure map. Types which already have an associated converter can be provided a structure using the DogStructure.named() factory. It associates the converter with a serial names which will be used by the polymorphic converters.

Structures must be emitted together with a converter by using the mixin StructureEmitter<T>.

Last updated