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
FieldsModifier 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
ConstructorsConstructorDescriptionDefaultSerdeRegistry(@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 SerdeConfigurationnewDecoderContext(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
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- TheSerdeConfigurationserializationConfiguration- TheSerializationConfigurationdeserializationConfiguration- 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- TheSerdeConfigurationserializationConfiguration- TheSerializationConfigurationdeserializationConfiguration- 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:SerdeRegistryOptional feature. Create a newSerdeRegistrywith the given configuration values. Anullparameter indicates the old configuration should be used.- Specified by:
cloneWithConfigurationin interfaceSerdeRegistry- Parameters:
configuration- TheSerdeConfigurationserializationConfiguration- TheSerializationConfigurationdeserializationConfiguration- TheDeserializationConfiguration- Returns:
- A new
SerdeRegistrywith 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: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) throws SerdeException 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
- 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: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
-
getSerdeConfiguration
-