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
In some cases it may require a separate method and in those cases a
MethodDef is used which inherits SerializerDef-
Method Summary
Modifier and TypeMethodDescriptiondefault intThis returns the absolute minimum size of the object.default booleanIf this is true it will request to generate the Measure method.voidwriteGet(MethodHandler mh)Writes code for decoding the Clazz the definition is designed to handle.default voidwriteMeasure(MethodHandler mh, Runnable valueLoad)Writes code for measuring the size required to encode the valuevoidwritePut(MethodHandler mh, Runnable valueLoad)Writes code for encoding the Clazz the definition is designed to handle.
-
Method Details
-
writePut
Writes code for encoding the Clazz the definition is designed to handle.- Parameters:
mh- A MethodHandlervalueLoad- A Runnable which pushes the Clazz value onto the stack.
-
writeGet
Writes code for decoding the Clazz the definition is designed to handle.- Parameters:
mh- A MethodHandler
-
writeMeasure
Writes code for measuring the size required to encode the value- Parameters:
mh- A MethodHandlervalueLoad- 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.
-