Interface FieldTypeSerializer<T>

Type Parameters:
T - type for which this serializer is being registered.
All Known Implementing Classes:
AdvancedEnumSerializer

public interface FieldTypeSerializer<T>
Interface representing a custom serializer and deserializer of a field type. You should write a custom one if you are not happy with how AnnotationConfig serializes and deserializes by default. You will also need to register your newly created class, implementing this interface, through SerializerRegistry.registerSerializer(Class, FieldTypeSerializer)
Since:
2.0.0
Author:
MrIvanPlays
  • Method Summary

    Modifier and Type
    Method
    Description
    default T
    AnnotationConfig invokes this call-back method during deserialization when it encounters a field of the specified type.
    default T
    deserialize(DataObject data, Field field, Object annotatedConfig)
    AnnotationConfig invokes this call-back method during deserialization when it encounters a field of the specified type.
    serialize(T value, Field field)
    AnnotationConfig invokes this call-back method during serialization when it encounters a field of the specified type.
  • Method Details

    • deserialize

      default T deserialize(DataObject data, Field field)
      AnnotationConfig invokes this call-back method during deserialization when it encounters a field of the specified type.
      Parameters:
      data - the data we received from the config
      field - the field we will attach this information to later on
      Returns:
      the generic value, the implementation of this interface has specified
    • deserialize

      default T deserialize(DataObject data, Field field, Object annotatedConfig)
      AnnotationConfig invokes this call-back method during deserialization when it encounters a field of the specified type.
      Parameters:
      data - the data we received from the config
      field - the field we will attach this information to later on
      annotatedConfig - the annotated config this field was retrieved from
      Returns:
      the generic value, the implementation of this interface has specified
    • serialize

      DataObject serialize(T value, Field field)
      AnnotationConfig invokes this call-back method during serialization when it encounters a field of the specified type.
      Parameters:
      value - the data we need serialized
      field - the field we got the value from
      Returns:
      a serialized object which is useful for dumping into a configuration file