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.-
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. -
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
-
Constructor Details
-
DefaultSerdeRegistry
public DefaultSerdeRegistry(@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
-
-
Method Details
-
cloneWithConfiguration
public SerdeRegistry cloneWithConfiguration(@Nullable SerdeConfiguration configuration, @Nullable SerializationConfiguration serializationConfiguration, @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
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
-