ValueClassSupport

expect object ValueClassSupport(source)
actual object ValueClassSupport(source)

JVM-specific helpers for value class support.

Properties

Link copied to clipboard
expect val KClass<*>.boxedClass: KClass<*>

Underlying property class of a value class, or self.

actual val KClass<*>.boxedClass: KClass<*>

Underlying property class of a value class or self.

Link copied to clipboard
expect val <T : Any> T.boxedValue: Any?

Underlying property value of a value class or self.

actual val <T : Any> T.boxedValue: Any?

Underlying property value of a value class or self. Includes workaround for Result class

Functions

Link copied to clipboard
fun KClass<*>.innermostBoxedClass(maxDepth: Int = 10): KClass<*>

Underlying property class of a value class or self. When the value class has one or more nested value classes, the innermost boxed class is returned (up to a maximum depth to prevent infinite recursion).

Link copied to clipboard
expect fun <T : Any> T.maybeUnboxValueForMethodReturn(method: Method): Any?

Unboxes the underlying property value of a value class or self, as long the unboxed value is appropriate for the given method's return type.

actual fun <T : Any> T.maybeUnboxValueForMethodReturn(method: Method): Any?

Unboxes the underlying property value of a value class or self, as long the unboxed value is appropriate for the given method's return type.