SerializersModuleBuilder
A builder class for SerializersModule DSL. To create an instance of builder, use SerializersModule factory function.
Functions
Registers provider associated with given generic kClass for contextual serialization. When a serializer is requested from a module, provider is being called with type arguments serializers of the particular kClass usage.
Adds serializer associated with given kClass for contextual serialization. If kClass has generic type parameters, consider registering provider instead.
Adds serializer associated with given type T for contextual serialization. Throws SerializationException if a module already has serializer associated with the given type. To overwrite an already registered serializer, SerializersModule.overwriteWith can be used.
Copies the content of module module into the current builder.
Adds serializer associated with given actualClass in the scope of baseClass for polymorphic serialization. Throws SerializationException if a module already has serializer associated with a actualClass. To overwrite an already registered serializer, SerializersModule.overwriteWith can be used.
Creates a builder to register subclasses of a given baseClass for polymorphic serialization. If baseSerializer is not null, registers it as a serializer for baseClass, which is useful if the base class is serializable itself. To register subclasses, PolymorphicModuleBuilder.subclass builder function can be used.
Adds a default deserializers provider associated with the given baseClass to the resulting module. defaultDeserializerProvider is invoked when no polymorphic serializers associated with the className
in the scope of baseClass were found. className
could be null
for formats that support nullable class discriminators (currently only Json
with useArrayPolymorphism
set to false
).
Adds a default serializers provider associated with the given baseClass to the resulting module. defaultSerializerProvider is invoked when no polymorphic serializers for value
in the scope of baseClass were found.