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.-
Field Summary
Modifier and TypeFieldDescriptionstatic final Serde<BigDecimal>
Deprecated.Internal serdes shouldn't be accessed as a static fieldstatic final Serde<BigInteger>
Deprecated.Internal serdes shouldn't be accessed as a static fieldstatic final Serde<boolean[]>
Deprecated.Internal serdes shouldn't be accessed as a static fieldDeprecated.Internal serdes shouldn't be accessed as a static fieldstatic final Serde<byte[]>
Deprecated.Internal serdes shouldn't be accessed as a static fieldDeprecated.Internal serdes shouldn't be accessed as a static fieldstatic final Serde<char[]>
Deprecated.Internal serdes shouldn't be accessed as a static fieldDeprecated.Internal serdes shouldn't be accessed as a static fieldDeprecated.Internal serdes shouldn't be accessed as a static fieldstatic final List<SerdeRegistrar<?>>
Deprecated.Internal serdes shouldn't be accessed as a static fieldstatic final Serde<double[]>
Deprecated.Internal serdes shouldn't be accessed as a static fieldDeprecated.Internal serdes shouldn't be accessed as a static fieldstatic final Serde<float[]>
Deprecated.Internal serdes shouldn't be accessed as a static fieldDeprecated.Internal serdes shouldn't be accessed as a static fieldstatic final Serde<int[]>
Deprecated.Internal serdes shouldn't be accessed as a static fieldDeprecated.Internal serdes shouldn't be accessed as a static fieldDeprecated.Internal serdes shouldn't be accessed as a static fieldstatic final Serde<long[]>
Deprecated.Internal serdes shouldn't be accessed as a static fieldDeprecated.Internal serdes shouldn't be accessed as a static fieldstatic final Serde<OptionalDouble>
Deprecated.Internal serdes shouldn't be accessed as a static fieldstatic final Serde<OptionalInt>
Deprecated.Internal serdes shouldn't be accessed as a static fieldstatic final Serde<OptionalLong>
Deprecated.Internal serdes shouldn't be accessed as a static fieldstatic final Serde<short[]>
Deprecated.Internal serdes shouldn't be accessed as a static fieldDeprecated.Internal serdes shouldn't be accessed as a static fieldDeprecated.Internal serdes shouldn't be accessed as a static fieldDeprecated.Internal serdes shouldn't be accessed as a static fieldDeprecated.Internal serdes shouldn't be accessed as a static fieldDeprecated.Internal serdes shouldn't be accessed as a static fieldDeprecated.Internal serdes shouldn't be accessed as a static field -
Constructor Summary
ConstructorDescriptionDefaultSerdeRegistry
(@Nullable io.micronaut.context.BeanContext beanContext, SerdeIntrospections introspections, io.micronaut.core.convert.ConversionService conversionService, SerdeConfiguration serdeConfiguration, SerializationConfiguration serializationConfiguration, DeserializationConfiguration deserializationConfiguration) Default constructor.DefaultSerdeRegistry
(io.micronaut.context.BeanContext beanContext, ObjectSerializer objectSerializer, ObjectDeserializer objectDeserializer, Serde<Object[]> objectArraySerde, SerdeIntrospections introspections, io.micronaut.core.convert.ConversionService conversionService) DefaultSerdeRegistry
(io.micronaut.context.BeanContext beanContext, ObjectSerializer objectSerializer, ObjectDeserializer objectDeserializer, Serde<Object[]> objectArraySerde, SerdeIntrospections introspections, io.micronaut.core.convert.ConversionService conversionService, SerdeConfiguration serdeConfiguration, SerializationConfiguration serializationConfiguration, DeserializationConfiguration deserializationConfiguration) Deprecated, for removal: This API element is subject to removal in a future version. -
Method Summary
Modifier and TypeMethodDescriptioncloneWithConfiguration
(@Nullable SerdeConfiguration configuration, @Nullable SerializationConfiguration serializationConfiguration, @Nullable DeserializationConfiguration deserializationConfiguration) Optional feature.<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.<T> @Nullable Serde<T>
findInternalSerde
(io.micronaut.core.type.Argument<T> type) Find internal serde by 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.final SerdeConfiguration
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
Deprecated.Internal serdes shouldn't be accessed as a static field -
LONG_SERDE
Deprecated.Internal serdes shouldn't be accessed as a static field -
SHORT_SERDE
Deprecated.Internal serdes shouldn't be accessed as a static field -
FLOAT_SERDE
Deprecated.Internal serdes shouldn't be accessed as a static field -
BYTE_SERDE
Deprecated.Internal serdes shouldn't be accessed as a static field -
DOUBLE_SERDE
Deprecated.Internal serdes shouldn't be accessed as a static field -
OPTIONAL_INT_SERDE
Deprecated.Internal serdes shouldn't be accessed as a static field -
OPTIONAL_DOUBLE_SERDE
Deprecated.Internal serdes shouldn't be accessed as a static field -
OPTIONAL_LONG_SERDE
Deprecated.Internal serdes shouldn't be accessed as a static field -
BIG_DECIMAL_SERDE
Deprecated.Internal serdes shouldn't be accessed as a static field -
BIG_INTEGER_SERDE
Deprecated.Internal serdes shouldn't be accessed as a static field -
UUID_SERDE
Deprecated.Internal serdes shouldn't be accessed as a static field -
URL_SERDE
Deprecated.Internal serdes shouldn't be accessed as a static field -
URI_SERDE
Deprecated.Internal serdes shouldn't be accessed as a static field -
CHARSET_SERDE
Deprecated.Internal serdes shouldn't be accessed as a static field -
TIME_ZONE_SERDE
Deprecated.Internal serdes shouldn't be accessed as a static field -
LOCALE_SERDE
Deprecated.Internal serdes shouldn't be accessed as a static field -
INT_ARRAY_SERDE
Deprecated.Internal serdes shouldn't be accessed as a static field -
LONG_ARRAY_SERDE
Deprecated.Internal serdes shouldn't be accessed as a static field -
FLOAT_ARRAY_SERDE
Deprecated.Internal serdes shouldn't be accessed as a static field -
SHORT_ARRAY_SERDE
Deprecated.Internal serdes shouldn't be accessed as a static field -
DOUBLE_ARRAY_SERDE
Deprecated.Internal serdes shouldn't be accessed as a static field -
BOOLEAN_ARRAY_SERDE
Deprecated.Internal serdes shouldn't be accessed as a static field -
BYTE_ARRAY_SERDE
Deprecated.Internal serdes shouldn't be accessed as a static field -
CHAR_ARRAY_SERDE
Deprecated.Internal serdes shouldn't be accessed as a static field -
STRING_SERDE
Deprecated.Internal serdes shouldn't be accessed as a static field -
BOOLEAN_SERDE
Deprecated.Internal serdes shouldn't be accessed as a static field -
CHAR_SERDE
Deprecated.Internal serdes shouldn't be accessed as a static field -
DEFAULT_SERDES
Deprecated.Internal serdes shouldn't be accessed as a static field
-
-
Constructor Details
-
DefaultSerdeRegistry
@Deprecated(forRemoval=true, since="2.9.0") public DefaultSerdeRegistry(io.micronaut.context.BeanContext beanContext, ObjectSerializer objectSerializer, ObjectDeserializer objectDeserializer, Serde<Object[]> objectArraySerde, SerdeIntrospections introspections, io.micronaut.core.convert.ConversionService conversionService, SerdeConfiguration serdeConfiguration, SerializationConfiguration serializationConfiguration, DeserializationConfiguration deserializationConfiguration) Deprecated, for removal: This API element is subject to removal in a future version.Default constructor.- Parameters:
beanContext
- The bean contextobjectSerializer
- The object serializerobjectDeserializer
- The object deserializerobjectArraySerde
- The object array Serdeintrospections
- The introspectionsconversionService
- The conversion serviceserdeConfiguration
- TheSerdeConfiguration
serializationConfiguration
- TheSerializationConfiguration
deserializationConfiguration
- TheDeserializationConfiguration
-
DefaultSerdeRegistry
@Inject public DefaultSerdeRegistry(@Nullable @Nullable io.micronaut.context.BeanContext beanContext, SerdeIntrospections introspections, io.micronaut.core.convert.ConversionService conversionService, SerdeConfiguration serdeConfiguration, SerializationConfiguration serializationConfiguration, DeserializationConfiguration deserializationConfiguration) Default constructor.- Parameters:
beanContext
- The bean contextintrospections
- The introspectionsconversionService
- The conversion serviceserdeConfiguration
- TheSerdeConfiguration
serializationConfiguration
- TheSerializationConfiguration
deserializationConfiguration
- TheDeserializationConfiguration
-
DefaultSerdeRegistry
@Deprecated public DefaultSerdeRegistry(io.micronaut.context.BeanContext beanContext, ObjectSerializer objectSerializer, ObjectDeserializer objectDeserializer, Serde<Object[]> objectArraySerde, SerdeIntrospections introspections, io.micronaut.core.convert.ConversionService conversionService) Deprecated.- Parameters:
beanContext
- The bean contextobjectSerializer
- The object serializerobjectDeserializer
- The object deserializerobjectArraySerde
- The object array Serdeintrospections
- The introspectionsconversionService
- The conversion service
-
-
Method Details
-
cloneWithConfiguration
public SerdeRegistry cloneWithConfiguration(@Nullable @Nullable SerdeConfiguration configuration, @Nullable @Nullable SerializationConfiguration serializationConfiguration, @Nullable @Nullable DeserializationConfiguration deserializationConfiguration) Description copied from interface:SerdeRegistry
Optional feature. Create a newSerdeRegistry
with the given configuration values. Anull
parameter indicates the old configuration should be used.- Specified by:
cloneWithConfiguration
in interfaceSerdeRegistry
- Parameters:
configuration
- TheSerdeConfiguration
serializationConfiguration
- TheSerializationConfiguration
deserializationConfiguration
- TheDeserializationConfiguration
- Returns:
- A new
SerdeRegistry
with the updated config
-
findInternalSerde
@Nullable @Internal public <T> @Nullable Serde<T> findInternalSerde(io.micronaut.core.type.Argument<T> type) Find internal serde by type.- Type Parameters:
T
- The serde type- Parameters:
type
- The serde type- Returns:
- a serde or null
-
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) throws SerdeException 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
- Throws:
SerdeException
- if no deserializer is found
-
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
-
getSerdeConfiguration
-