Class ErrorCatchingSerializer<T>

java.lang.Object
io.micronaut.serde.support.serializers.ErrorCatchingSerializer<T>
Type Parameters:
T - The serializer type
All Implemented Interfaces:
Serializer<T>

@Internal public class ErrorCatchingSerializer<T> extends Object implements Serializer<T>
The errors catching Serializer.
Author:
Denis Stepanov
  • Method Details

    • serialize

      public final void serialize(Encoder encoder, Serializer.EncoderContext context, io.micronaut.core.type.Argument<? extends T> type, T values) 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
      values - The value to serialize, never null. Callers should encode null values directly.
      Throws:
      IOException - If an error occurs during serialization
    • createSpecific

      public final Serializer<T> createSpecific(Serializer.EncoderContext context, io.micronaut.core.type.Argument<? extends T> type) throws SerdeException
      Description copied from interface: Serializer
      Create a more specific serializer for the given definition.
      Specified by:
      createSpecific in interface Serializer<T>
      Parameters:
      context - The encoder context
      type - The type definition including any annotation metadata
      Returns:
      The more specific serializer
      Throws:
      SerdeException
    • isEmpty

      public final 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

      public final 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
    • getSerializer

      public final Serializer<T> getSerializer()
      Returns the wrapped serializer.
      Returns:
      The wrapped serializer