Shortcut which deserializes the value and assumes the whole ArrayBuffer for this action.
the ArrayBuffer which contains the value
This method maps the value back from Base to Origin.
the value to map
This method maps the Origin value to Base. This method should throw an error if the value is not in fact of type origin.
the value to map
This method will be called by the typeCheck method. Before calling the typeCheck of the parent with the mapped Base value.
This method should throw an error when the value is not of type Origin. This error should be precise and use the provided name as identifier when addressing the value to increase the error message readability.
the value to check
the identifier name this value had in the greater scope
Shortcut which creates an appropriately sized ArrayBuffer for the value and serializes the value.
the value to serialize
Generated using TypeDoc
This class is meant to help to define serializers which map values from one type to another before serialization. This mapping is meant to be done Origin -> Base -> Binary -> Base -> Origin
In this class you just define the mapping from Origin to Base and back and add the serializer for the Base type. This also allows you to chain those serializers.
This abstract class reduces the number of methods one needs to implement in comparison to a full custom class. Just the Origin => Base, Base => Origin and the type check need to be implemented.