Interface SerializerDef

All Known Implementing Classes:
ArrayDef, BoxedIODef, ClassDef, EnumDef, IndexedDef, ListDef, MapDef, MethodDef, PrimitiveArrayIODef, PrimitiveIODef, SetDef, StringIODef, SubclassDef

public interface SerializerDef
A SerializerDef is responsible for writing code that handles a given class.
In some cases it may require a separate method and in those cases a MethodDef is used which inherits SerializerDef
  • Method Summary

    Modifier and Type
    Method
    Description
    default int
    This returns the absolute minimum size of the object.
    default boolean
    If this is true it will request to generate the Measure method.
    void
    Writes code for decoding the Clazz the definition is designed to handle.
    default void
    writeMeasure​(MethodHandler mh, Runnable valueLoad)
    Writes code for measuring the size required to encode the value
    void
    writePut​(MethodHandler mh, Runnable valueLoad)
    Writes code for encoding the Clazz the definition is designed to handle.
  • Method Details

    • writePut

      void writePut(MethodHandler mh, Runnable valueLoad)
      Writes code for encoding the Clazz the definition is designed to handle.
      Parameters:
      mh - A MethodHandler
      valueLoad - A Runnable which pushes the Clazz value onto the stack.
    • writeGet

      void writeGet(MethodHandler mh)
      Writes code for decoding the Clazz the definition is designed to handle.
      Parameters:
      mh - A MethodHandler
    • writeMeasure

      default void writeMeasure(MethodHandler mh, Runnable valueLoad)
      Writes code for measuring the size required to encode the value
      Parameters:
      mh - A MethodHandler
      valueLoad - A Runnable which pushes the Clazz value onto the stack.
    • getStaticSize

      default int getStaticSize()
      This returns the absolute minimum size of the object.
      If the size is dependent on the runtime object itself this value will be appended to the measure methods results.
      Returns:
      Object Minimum encoding size
    • hasDynamicSize

      default boolean hasDynamicSize()
      If this is true it will request to generate the Measure method.
      If this is false only the static size amount will be used.
      Returns:
      if it has a Dynamic Size.