CustomPersistentDataType

A custom persistent data type that allows for conversion between a primitive type and a complex type.

This interface extends the PersistentDataType interface and provides methods to convert between the primitive type and the complex type using an intermediate type.

The custom type is defined by the user and can be any type that is not a primitive type.

Author

Fantamomo

Since

1.0-SNAPSHOT

Parameters

P

The primitive type.

I

The intermediate type.

C

The custom type.

Inheritors

Types

Link copied to clipboard

A builder for creating a custom persistent data type.

Link copied to clipboard
class CustomPersistentDataTypeImpl<P : Any, I : Any, C : Any>(val converter: PersistentDataType<P, I>, customClass: KClass<C>, toIntermediateFunc: (C) -> I, toCustomFunc: (I) -> C) : CustomPersistentDataType<P, I, C>

An implementation of the CustomPersistentDataType interface.

Properties

Link copied to clipboard

The converter used to convert between the primitive type and the intermediate type.

Functions

Link copied to clipboard
@JvmName(name = "createList")
inline fun <P : Any, C : Any> PersistentDataType<P, C>.asList(): ListPersistentDataType<P, C>
Link copied to clipboard
@JvmName(name = "createNullable")
inline fun <P : Any, C : Any> PersistentDataType<P, C>.asNullable(): NullablePersistentDataType<P, C>
Link copied to clipboard
@JvmName(name = "createSet")
inline fun <P : Any, C : Any> PersistentDataType<P, C>.asSet(): SetPersistentDataType<P, C>
Link copied to clipboard
open override fun convertToComplex(primitive: P): C

Converts a primitive data type to a complex data type.

Link copied to clipboard
open override fun convertToPrimitive(complex: C): P

Converts a complex data type to a primitive data type.

Link copied to clipboard
abstract fun getComplexType(): KClass<C>

Returns the KClass of the complex data type.

Link copied to clipboard
open override fun getPrimitiveType(): KClass<P>

Returns the KClass of the primitive data type.

Link copied to clipboard
abstract fun toCustom(intermediate: I): C

Converts the intermediate type to the custom type.

Link copied to clipboard
abstract fun toIntermediate(custom: C): I

Converts the custom type to the intermediate type.

Link copied to clipboard
@JvmName(name = "createMap")
infix inline fun <KP : Any, KC : Any, VP : Any, VC : Any> PersistentDataType<KP, KC>.withMap(valueType: PersistentDataType<VP, VC>): MapPersistentDataType<KP, KC, VP, VC>