Class DefaultSerdeRegistry

java.lang.Object
io.micronaut.serde.support.DefaultSerdeRegistry
All Implemented Interfaces:
io.micronaut.core.convert.ConversionServiceProvider, DeserializerLocator, NamingStrategyLocator, SerdeRegistry, SerializerLocator

@Singleton public class DefaultSerdeRegistry extends Object implements SerdeRegistry
Default implementation of the SerdeRegistry interface.
  • Field Details

    • INTEGER_SERDE

      public static final io.micronaut.serde.support.DefaultSerdeRegistry.IntegerSerde INTEGER_SERDE
    • LONG_SERDE

      public static final io.micronaut.serde.support.DefaultSerdeRegistry.LongSerde LONG_SERDE
    • SHORT_SERDE

      public static final io.micronaut.serde.support.DefaultSerdeRegistry.ShortSerde SHORT_SERDE
    • FLOAT_SERDE

      public static final io.micronaut.serde.support.DefaultSerdeRegistry.FloatSerde FLOAT_SERDE
    • BYTE_SERDE

      public static final io.micronaut.serde.support.DefaultSerdeRegistry.ByteSerde BYTE_SERDE
    • DOUBLE_SERDE

      public static final io.micronaut.serde.support.DefaultSerdeRegistry.DoubleSerde DOUBLE_SERDE
    • OPTIONAL_INT_SERDE

      public static final io.micronaut.serde.support.DefaultSerdeRegistry.OptionalIntSerde OPTIONAL_INT_SERDE
    • OPTIONAL_DOUBLE_SERDE

      public static final io.micronaut.serde.support.DefaultSerdeRegistry.OptionalDoubleSerde OPTIONAL_DOUBLE_SERDE
    • OPTIONAL_LONG_SERDE

      public static final io.micronaut.serde.support.DefaultSerdeRegistry.OptionalLongSerde OPTIONAL_LONG_SERDE
    • BIG_DECIMAL_SERDE

      public static final io.micronaut.serde.support.DefaultSerdeRegistry.BigDecimalSerde BIG_DECIMAL_SERDE
    • BIG_INTEGER_SERDE

      public static final io.micronaut.serde.support.DefaultSerdeRegistry.BigIntegerSerde BIG_INTEGER_SERDE
    • UUID_SERDE

      public static final io.micronaut.serde.support.DefaultSerdeRegistry.UUIDSerde UUID_SERDE
    • URL_SERDE

      public static final io.micronaut.serde.support.DefaultSerdeRegistry.URLSerde URL_SERDE
    • URI_SERDE

      public static final io.micronaut.serde.support.DefaultSerdeRegistry.URISerde URI_SERDE
    • CHARSET_SERDE

      public static final io.micronaut.serde.support.DefaultSerdeRegistry.CharsetSerde CHARSET_SERDE
    • TIME_ZONE_SERDE

      public static final io.micronaut.serde.support.DefaultSerdeRegistry.TimeZoneSerde TIME_ZONE_SERDE
    • LOCALE_SERDE

      public static final io.micronaut.serde.support.DefaultSerdeRegistry.LocaleSerde LOCALE_SERDE
    • INT_ARRAY_SERDE

      public static final io.micronaut.serde.support.DefaultSerdeRegistry.IntArraySerde INT_ARRAY_SERDE
    • LONG_ARRAY_SERDE

      public static final io.micronaut.serde.support.DefaultSerdeRegistry.LongArraySerde LONG_ARRAY_SERDE
    • FLOAT_ARRAY_SERDE

      public static final io.micronaut.serde.support.DefaultSerdeRegistry.FloatArraySerde FLOAT_ARRAY_SERDE
    • SHORT_ARRAY_SERDE

      public static final io.micronaut.serde.support.DefaultSerdeRegistry.ShortArraySerde SHORT_ARRAY_SERDE
    • DOUBLE_ARRAY_SERDE

      public static final io.micronaut.serde.support.DefaultSerdeRegistry.DoubleArraySerde DOUBLE_ARRAY_SERDE
    • BOOLEAN_ARRAY_SERDE

      public static final io.micronaut.serde.support.DefaultSerdeRegistry.BooleanArraySerde BOOLEAN_ARRAY_SERDE
    • BYTE_ARRAY_SERDE

      @Deprecated public static final DefaultSerdeRegistry.ByteArraySerde BYTE_ARRAY_SERDE
      Deprecated.
      This serde needs configuration now.
    • CHAR_ARRAY_SERDE

      public static final io.micronaut.serde.support.DefaultSerdeRegistry.CharArraySerde CHAR_ARRAY_SERDE
    • STRING_SERDE

      public static final io.micronaut.serde.support.DefaultSerdeRegistry.StringSerde STRING_SERDE
    • BOOLEAN_SERDE

      public static final io.micronaut.serde.support.DefaultSerdeRegistry.BooleanSerde BOOLEAN_SERDE
    • CHAR_SERDE

      public static final io.micronaut.serde.support.DefaultSerdeRegistry.CharSerde CHAR_SERDE
    • DEFAULT_SERDES

      public static final List<io.micronaut.serde.support.DefaultSerdeRegistry.SerdeRegistrar<?>> DEFAULT_SERDES
  • Constructor Details

    • DefaultSerdeRegistry

      public DefaultSerdeRegistry(io.micronaut.context.BeanContext beanContext, ObjectSerializer objectSerializer, ObjectDeserializer objectDeserializer, Serde<Object[]> objectArraySerde, SerdeIntrospections introspections, io.micronaut.core.convert.ConversionService conversionService)
      Default constructor.
      Parameters:
      beanContext - The bean context
      objectSerializer - The object serializer
      objectDeserializer - The object deserializer
      objectArraySerde - The object array Serde
      introspections - The introspections
      conversionService - The conversion service
  • Method Details

    • findCustomSerializer

      public <T, D extends Serializer<? extends T>> D findCustomSerializer(Class<? extends D> serializerClass) throws SerdeException
      Description copied from interface: SerializerLocator
      Gets a custom serializer.
      Specified by:
      findCustomSerializer in interface SerializerLocator
      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
    • findCustomDeserializer

      public <T, D extends Deserializer<? extends T>> D findCustomDeserializer(Class<? extends D> deserializerClass) throws SerdeException
      Description copied from interface: DeserializerLocator
      Gets a custom deserializer.
      Specified by:
      findCustomDeserializer in interface DeserializerLocator
      Type Parameters:
      T - The generic type
      D - The deserializer type
      Parameters:
      deserializerClass - The deserializer class, should not be null
      Returns:
      The deserializer
      Throws:
      SerdeException - if no deserializer is found
    • findNamingStrategy

      public <D extends PropertyNamingStrategy> D findNamingStrategy(Class<? extends D> namingStrategyClass) throws SerdeException
      Description copied from interface: NamingStrategyLocator
      Gets a naming strategy.
      Specified by:
      findNamingStrategy in interface NamingStrategyLocator
      Type Parameters:
      D - The naming strategy type
      Parameters:
      namingStrategyClass - The naming strategy class, should not be null
      Returns:
      The naming strategy
      Throws:
      SerdeException - if no naming strategy is found
    • findDeserializer

      public <T> Deserializer<? extends T> findDeserializer(io.micronaut.core.type.Argument<? extends T> type)
      Description copied from interface: DeserializerLocator
      Finds a deserializer for the given type.
      Specified by:
      findDeserializer in interface DeserializerLocator
      Type Parameters:
      T - The generic type
      Parameters:
      type - The type, should not be null
      Returns:
      The deserializer
    • getDeserializableSubtypes

      public <T> Collection<io.micronaut.core.beans.BeanIntrospection<? extends T>> getDeserializableSubtypes(Class<T> superType)
      Description copied from interface: DeserializerLocator
      Locates desrializable subtypes for the given super type.
      Specified by:
      getDeserializableSubtypes in interface DeserializerLocator
      Type Parameters:
      T - The generic super type
      Parameters:
      superType - The super type
      Returns:
      The subtypes, never null
    • findSerializer

      public <T> Serializer<? super T> findSerializer(io.micronaut.core.type.Argument<? extends T> type) throws SerdeException
      Description copied from interface: SerializerLocator
      Finds a serializer for the given type.
      Specified by:
      findSerializer in interface SerializerLocator
      Type Parameters:
      T - The generic type
      Parameters:
      type - The type
      Returns:
      The serializer
      Throws:
      SerdeException - if an exception occurs
    • newEncoderContext

      public Serializer.EncoderContext newEncoderContext(Class<?> view)
      Description copied from interface: SerdeRegistry
      Creates a new encoder context.
      Specified by:
      newEncoderContext in interface SerdeRegistry
      Parameters:
      view - The view
      Returns:
      The encoder context
    • newDecoderContext

      public Deserializer.DecoderContext newDecoderContext(Class<?> view)
      Description copied from interface: SerdeRegistry
      Creates a new decoder context.
      Specified by:
      newDecoderContext in interface SerdeRegistry
      Parameters:
      view - The view
      Returns:
      The decoder context
    • getConversionService

      public io.micronaut.core.convert.ConversionService getConversionService()
      Specified by:
      getConversionService in interface io.micronaut.core.convert.ConversionServiceProvider