Interface SerializerLocator

All Known Subinterfaces:
SerdeRegistry, Serializer.EncoderContext
All Known Implementing Classes:
DefaultSerdeRegistry

public interface SerializerLocator
Locator strategy interface for serializers.
Since:
1.0.0
  • Method Summary

    Modifier and Type
    Method
    Description
    <T, D extends Serializer<? extends T>>
    D
    findCustomSerializer(@NonNull Class<? extends D> serializerClass)
    Gets a custom serializer.
    <T> @NonNull Serializer<? super T>
    findSerializer(@NonNull io.micronaut.core.type.Argument<? extends T> forType)
    Finds a serializer for the given type.
    default <T> @NonNull Serializer<? super T>
    findSerializer(@NonNull Class<? extends T> forType)
    Finds a serializer for the given type.
  • Method Details

    • findCustomSerializer

      @NonNull <T, D extends Serializer<? extends T>> D findCustomSerializer(@NonNull @NonNull Class<? extends D> serializerClass) throws SerdeException
      Gets a custom serializer.
      Type Parameters:
      T - The generic type
      D - The serializer type
      Parameters:
      serializerClass - The serializer class, should not be null
      Returns:
      The serializer
      Throws:
      SerdeException - if no serializer is found
    • findSerializer

      @NonNull <T> @NonNull Serializer<? super T> findSerializer(@NonNull @NonNull io.micronaut.core.type.Argument<? extends T> forType) throws SerdeException
      Finds a serializer for the given type.
      Type Parameters:
      T - The generic type
      Parameters:
      forType - The type
      Returns:
      The serializer
      Throws:
      SerdeException - if an exception occurs
    • findSerializer

      @NonNull default <T> @NonNull Serializer<? super T> findSerializer(@NonNull @NonNull Class<? extends T> forType) throws SerdeException
      Finds a serializer for the given type.
      Type Parameters:
      T - The generic type
      Parameters:
      forType - The type
      Returns:
      The serializer
      Throws:
      SerdeException - if an exception occurs