SerializersModule
SerializersModule is a collection of serializers used by ContextualSerializer and PolymorphicSerializer to override or provide serializers at the runtime, whereas at the compile-time they provided by the serialization plugin. It can be considered as a map where serializers can be found using their statically known KClasses.
To enable runtime serializers resolution, one of the special annotations must be used on target types (Polymorphic or Contextual), and a serial module with serializers should be used during construction of SerialFormat.
See also
Functions
Returns a contextual serializer associated with a given kClass. If given class has generic parameters and module has provider for kClass, typeArgumentsSerializers are used to create serializer. This method is used in context-sensitive operations on a property marked with Contextual by a ContextualSerializer.
Returns a polymorphic serializer registered for a class of the given value in the scope of baseClass.
Returns a polymorphic deserializer registered for a serializedClassName in the scope of baseClass or default value constructed from serializedClassName if a default serializer provider was registered.
Extensions
Looks up a descriptor of serializer registered for contextual serialization in this, using SerialDescriptor.capturedKClass as a key.
Retrieves a collection of descriptors which serializers are registered for polymorphic serialization in this with base class equal to descriptor's SerialDescriptor.capturedKClass. This method does not retrieve serializers registered with PolymorphicModuleBuilder.default.
Returns a combination of two serial modules
Returns a combination of two serial modules
Retrieves serializer for the given type T from the current SerializersModule and, if not found, fallbacks to plain serializer method.
Attempts to create a serializer for the given type and fallbacks to contextual lookup for non-serializable types. type argument can be obtained with experimental typeOf method.
Retrieves serializer for the given reflective Java type using reflective construction and contextual lookup for non-serializable types.
Attempts to create a serializer for the given type and fallbacks to contextual lookup for non-serializable types. type argument can be obtained with experimental typeOf method. Returns null
if serializer cannot be created (provided type or its type argument is not serializable and is not registered in this module).
Retrieves serializer for the given reflective Java type using reflective construction and contextual lookup for non-serializable types.