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 class
Serde for byte arrays. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final io.micronaut.serde.support.DefaultSerdeRegistry.BigDecimalSerde
static final io.micronaut.serde.support.DefaultSerdeRegistry.BigIntegerSerde
static final io.micronaut.serde.support.DefaultSerdeRegistry.BooleanArraySerde
static final io.micronaut.serde.support.DefaultSerdeRegistry.BooleanSerde
static final DefaultSerdeRegistry.ByteArraySerde
Deprecated.This serde needs configuration now.static final io.micronaut.serde.support.DefaultSerdeRegistry.ByteSerde
static final io.micronaut.serde.support.DefaultSerdeRegistry.CharArraySerde
static final io.micronaut.serde.support.DefaultSerdeRegistry.CharSerde
static final io.micronaut.serde.support.DefaultSerdeRegistry.CharsetSerde
static final List<io.micronaut.serde.support.DefaultSerdeRegistry.SerdeRegistrar<?>>
static final io.micronaut.serde.support.DefaultSerdeRegistry.DoubleArraySerde
static final io.micronaut.serde.support.DefaultSerdeRegistry.DoubleSerde
static final io.micronaut.serde.support.DefaultSerdeRegistry.FloatArraySerde
static final io.micronaut.serde.support.DefaultSerdeRegistry.FloatSerde
static final io.micronaut.serde.support.DefaultSerdeRegistry.IntArraySerde
static final io.micronaut.serde.support.DefaultSerdeRegistry.IntegerSerde
static final io.micronaut.serde.support.DefaultSerdeRegistry.LocaleSerde
static final io.micronaut.serde.support.DefaultSerdeRegistry.LongArraySerde
static final io.micronaut.serde.support.DefaultSerdeRegistry.LongSerde
static final io.micronaut.serde.support.DefaultSerdeRegistry.OptionalDoubleSerde
static final io.micronaut.serde.support.DefaultSerdeRegistry.OptionalIntSerde
static final io.micronaut.serde.support.DefaultSerdeRegistry.OptionalLongSerde
static final io.micronaut.serde.support.DefaultSerdeRegistry.ShortArraySerde
static final io.micronaut.serde.support.DefaultSerdeRegistry.ShortSerde
static final io.micronaut.serde.support.DefaultSerdeRegistry.StringSerde
static final io.micronaut.serde.support.DefaultSerdeRegistry.TimeZoneSerde
static final io.micronaut.serde.support.DefaultSerdeRegistry.URISerde
static final io.micronaut.serde.support.DefaultSerdeRegistry.URLSerde
static 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, wait
Methods inherited from interface io.micronaut.serde.DeserializerLocator
findDeserializer
Methods 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:SerializerLocator
Gets a custom serializer.- Specified by:
findCustomSerializer
in 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:DeserializerLocator
Gets a custom deserializer.- Specified by:
findCustomDeserializer
in 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:NamingStrategyLocator
Gets a naming strategy.- Specified by:
findNamingStrategy
in 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:DeserializerLocator
Finds a deserializer for the given type.- Specified by:
findDeserializer
in 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:DeserializerLocator
Locates desrializable subtypes for the given super type.- Specified by:
getDeserializableSubtypes
in 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:SerializerLocator
Finds a serializer for the given type.- Specified by:
findSerializer
in 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:SerdeRegistry
Creates a new encoder context.- Specified by:
newEncoderContext
in interfaceSerdeRegistry
- Parameters:
view
- The view- Returns:
- The encoder context
-
newDecoderContext
Description copied from interface:SerdeRegistry
Creates a new decoder context.- Specified by:
newDecoderContext
in interfaceSerdeRegistry
- Parameters:
view
- The view- Returns:
- The decoder context
-
getConversionService
public io.micronaut.core.convert.ConversionService getConversionService()- Specified by:
getConversionService
in interfaceio.micronaut.core.convert.ConversionServiceProvider
-