register

inline fun <T : Any> register(typeName: String)

Registers T under typeName.

Parameters

typeName

The discriminator, as the database stores it.

Type Parameters

T

The class, which has to be @Serializable.


inline fun <T : Any> register()

Registers T under the name its DynamicallyMappable declares.

The annotation is multiplatform, so it can sit on a class shared with another platform. Stating the name at the call instead is always available and wins where both are present.

Type Parameters

T

The class, which has to be @Serializable and carry DynamicallyMappable.


fun <T : Any> register(kClass: KClass<T>, serializer: KSerializer<T>, typeName: String)

Registers kClass with a serializer supplied by the caller.

The reflective path, for a scanner that found the class rather than a call that named it.

Parameters

kClass

The class, which has to be @Serializable.

serializer

Its serializer.

typeName

The discriminator, as the database stores it.

Throws

INVALID_ARGUMENT where the name is blank, or is already taken by another class.


fun register(kClass: KClass<*>, typeName: String)

Registers kClass by looking its serializer up from its own type.

The reflective path, for a caller holding a class rather than a type argument.

Parameters

kClass

The class, which has to be @Serializable.

typeName

The discriminator, as the database stores it.


fun register(kClass: KClass<*>)

Registers kClass under the name its DynamicallyMappable declares.

The path a scanner takes: it found the class by the annotation, so the annotation is what names it.

Parameters

kClass

The class, which has to be @Serializable and carry DynamicallyMappable.