Package io.micronaut.serde.support
Class DefaultSerdeRegistry
java.lang.Object
io.micronaut.serde.support.DefaultSerdeRegistry
- All Implemented Interfaces:
io.micronaut.core.convert.ConversionServiceProvider,DeserializerLocator,NamingStrategyLocator,SerdeRegistry,SerializerLocator
Default implementation of the
SerdeRegistry interface.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classSerde for byte arrays. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final io.micronaut.serde.support.DefaultSerdeRegistry.BigDecimalSerdestatic final io.micronaut.serde.support.DefaultSerdeRegistry.BigIntegerSerdestatic final io.micronaut.serde.support.DefaultSerdeRegistry.BooleanArraySerdestatic final io.micronaut.serde.support.DefaultSerdeRegistry.BooleanSerdestatic final DefaultSerdeRegistry.ByteArraySerdeDeprecated.This serde needs configuration now.static final io.micronaut.serde.support.DefaultSerdeRegistry.ByteSerdestatic final io.micronaut.serde.support.DefaultSerdeRegistry.CharArraySerdestatic final io.micronaut.serde.support.DefaultSerdeRegistry.CharSerdestatic final io.micronaut.serde.support.DefaultSerdeRegistry.CharsetSerdestatic final List<io.micronaut.serde.support.DefaultSerdeRegistry.SerdeRegistrar<?>>static final io.micronaut.serde.support.DefaultSerdeRegistry.DoubleArraySerdestatic final io.micronaut.serde.support.DefaultSerdeRegistry.DoubleSerdestatic final io.micronaut.serde.support.DefaultSerdeRegistry.FloatArraySerdestatic final io.micronaut.serde.support.DefaultSerdeRegistry.FloatSerdestatic final io.micronaut.serde.support.DefaultSerdeRegistry.IntArraySerdestatic final io.micronaut.serde.support.DefaultSerdeRegistry.IntegerSerdestatic final io.micronaut.serde.support.DefaultSerdeRegistry.LocaleSerdestatic final io.micronaut.serde.support.DefaultSerdeRegistry.LongArraySerdestatic final io.micronaut.serde.support.DefaultSerdeRegistry.LongSerdestatic final io.micronaut.serde.support.DefaultSerdeRegistry.OptionalDoubleSerdestatic final io.micronaut.serde.support.DefaultSerdeRegistry.OptionalIntSerdestatic final io.micronaut.serde.support.DefaultSerdeRegistry.OptionalLongSerdestatic final io.micronaut.serde.support.DefaultSerdeRegistry.ShortArraySerdestatic final io.micronaut.serde.support.DefaultSerdeRegistry.ShortSerdestatic final io.micronaut.serde.support.DefaultSerdeRegistry.StringSerdestatic final io.micronaut.serde.support.DefaultSerdeRegistry.TimeZoneSerdestatic final io.micronaut.serde.support.DefaultSerdeRegistry.URISerdestatic final io.micronaut.serde.support.DefaultSerdeRegistry.URLSerdestatic final io.micronaut.serde.support.DefaultSerdeRegistry.UUIDSerde -
Constructor Summary
ConstructorsConstructorDescriptionDefaultSerdeRegistry(io.micronaut.context.BeanContext beanContext, ObjectSerializer objectSerializer, ObjectDeserializer objectDeserializer, Serde<Object[]> objectArraySerde, SerdeIntrospections introspections, io.micronaut.core.convert.ConversionService conversionService) Default constructor. -
Method Summary
Modifier and TypeMethodDescription<T,D extends Deserializer<? extends T>>
DfindCustomDeserializer(Class<? extends D> deserializerClass) Gets a custom deserializer.<T,D extends Serializer<? extends T>>
DfindCustomSerializer(Class<? extends D> serializerClass) Gets a custom serializer.<T> Deserializer<? extends T>findDeserializer(io.micronaut.core.type.Argument<? extends T> type) Finds a deserializer for the given type.<D extends PropertyNamingStrategy>
DfindNamingStrategy(Class<? extends D> namingStrategyClass) Gets a naming strategy.<T> Serializer<? super T>findSerializer(io.micronaut.core.type.Argument<? extends T> type) Finds a serializer for the given type.io.micronaut.core.convert.ConversionService<T> Collection<io.micronaut.core.beans.BeanIntrospection<? extends T>>getDeserializableSubtypes(Class<T> superType) Locates desrializable subtypes for the given super type.newDecoderContext(Class<?> view) Creates a new decoder context.newEncoderContext(Class<?> view) Creates a new encoder context.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.micronaut.serde.DeserializerLocator
findDeserializerMethods inherited from interface io.micronaut.serde.SerializerLocator
findSerializer
-
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.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 contextobjectSerializer- The object serializerobjectDeserializer- The object deserializerobjectArraySerde- The object array Serdeintrospections- The introspectionsconversionService- 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:SerializerLocatorGets a custom serializer.- Specified by:
findCustomSerializerin interfaceSerializerLocator- Type Parameters:
T- The generic typeD- The serializer type- Parameters:
serializerClass- The serializer class, should not benull- 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:DeserializerLocatorGets a custom deserializer.- Specified by:
findCustomDeserializerin interfaceDeserializerLocator- Type Parameters:
T- The generic typeD- The deserializer type- Parameters:
deserializerClass- The deserializer class, should not benull- 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:NamingStrategyLocatorGets a naming strategy.- Specified by:
findNamingStrategyin interfaceNamingStrategyLocator- Type Parameters:
D- The naming strategy type- Parameters:
namingStrategyClass- The naming strategy class, should not benull- 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:DeserializerLocatorFinds a deserializer for the given type.- Specified by:
findDeserializerin interfaceDeserializerLocator- Type Parameters:
T- The generic type- Parameters:
type- The type, should not benull- Returns:
- The deserializer
-
getDeserializableSubtypes
public <T> Collection<io.micronaut.core.beans.BeanIntrospection<? extends T>> getDeserializableSubtypes(Class<T> superType) Description copied from interface:DeserializerLocatorLocates desrializable subtypes for the given super type.- Specified by:
getDeserializableSubtypesin interfaceDeserializerLocator- 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:SerializerLocatorFinds a serializer for the given type.- Specified by:
findSerializerin interfaceSerializerLocator- Type Parameters:
T- The generic type- Parameters:
type- The type- Returns:
- The serializer
- Throws:
SerdeException- if an exception occurs
-
newEncoderContext
Description copied from interface:SerdeRegistryCreates a new encoder context.- Specified by:
newEncoderContextin interfaceSerdeRegistry- Parameters:
view- The view- Returns:
- The encoder context
-
newDecoderContext
Description copied from interface:SerdeRegistryCreates a new decoder context.- Specified by:
newDecoderContextin interfaceSerdeRegistry- Parameters:
view- The view- Returns:
- The decoder context
-
getConversionService
public io.micronaut.core.convert.ConversionService getConversionService()- Specified by:
getConversionServicein interfaceio.micronaut.core.convert.ConversionServiceProvider
-