Interface CustomizableSerializer<T>

Type Parameters:
T - The serializer type
All Superinterfaces:
Serializer<T>
All Known Implementing Classes:
ObjectArraySerde, ObjectSerializer

public interface CustomizableSerializer<T> extends Serializer<T>
The type of serializer that requires a specific implementation by calling Serializer.createSpecific(Serializer.EncoderContext, Argument).
Author:
Denis Stepanov
  • Method Details

    • serialize

      default void serialize(Encoder encoder, Serializer.EncoderContext context, io.micronaut.core.type.Argument<? extends T> type, T value) throws IOException
      Description copied from interface: Serializer
      Serializes the given value using the passed Encoder.
      Specified by:
      serialize in interface Serializer<T>
      Parameters:
      encoder - The encoder to use
      context - The encoder context, never null
      type - Models the generic type of the value
      value - The value, can be null
      Throws:
      IOException - If an error occurs during serialization
    • isEmpty

      default boolean isEmpty(Serializer.EncoderContext context, @Nullable T value)
      Description copied from interface: Serializer
      Used for JsonInclude.Include#NON_EMPTY checking.
      Specified by:
      isEmpty in interface Serializer<T>
      Parameters:
      context - The encoder context
      value - The check to check
      Returns:
      Return true if the value is empty
    • isAbsent

      default boolean isAbsent(Serializer.EncoderContext context, @Nullable T value)
      Description copied from interface: Serializer
      Used for JsonInclude.Include#NON_ABSENT checking.
      Specified by:
      isAbsent in interface Serializer<T>
      Parameters:
      context - The encoder context
      value - The value to check
      Returns:
      Return true if the value is absent