from

inline fun <T : Any> from(value: T): DynamicDto

Convenient factory method for creating a DynamicDto instance from a domain object.

This is the preferred path for end users. Uses reflection to automatically find the typeName from the DynamicallyMappable annotation and serializes the object to JsonElement.

Return

New, fully constructed DynamicDto instance.

Parameters

value

Object instance to wrap. Must have the DynamicallyMappable and @Serializable annotations.

Throws

if the object's class doesn't have the required annotation or if an error occurs during JSON serialization.


fun from(value: Any, typeName: String, serializer: KSerializer<Any>): DynamicDto

FRAMEWORK PATH Creates DTO using an externally provided (cached) serializer. Zero reflection, maximum performance.