AnyPersistentDataType

A singleton implementation of PersistentDataType that allows handling of any data type as both its complex and primitive representations, without any transformation.

This type is primarily intended for advanced internal use cases where generic handling of data is required. Both the complex and primitive types are represented as Any, and the conversion methods act as identity functions.

This class is annotated with InternalPersistentApi, signaling that it is intended for internal use only and may change or be removed in future versions.

Note: Because this type accepts Any as both its complex and primitive types, it does not perform type safety checks or transformations. Use with caution.

Note: While all PersistentDataContainer implementations in this library support this data type, and it is recommended for third-party implementations to support it as well, there is no guarantee that external implementations will provide support for it.

Author

Fantamomo

Since

1.0-SNAPSHOT

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: Any): Any

Converts a primitive data type to a complex data type.

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

Converts a complex data type to a primitive data type.

Link copied to clipboard
open override fun getComplexType(): KClass<Any>

Returns the KClass of the complex data type.

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

Returns the KClass of the primitive data 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>