GenerableProvider

interface GenerableProvider


Interface used by the java.util.ServiceLoader for runtime discovery of generated schemas.

During compilation, the KSP (Kotlin Symbol Processing) plugin automatically generates an implementation of this interface for each class annotated with @Generable. The generated implementation acts as a provider, exposing the structural metadata (like guide details and constraints) of the target class via GenerableDetail.

Example of reading the generated providers at runtime:

val generableProviders: Map<KClass<*>, GenerableProvider> by lazy {
ServiceLoader.load(GenerableProvider::class.java, GenerableProvider::class.java.classLoader)
.associateBy { it.targetClass }
}

Summary

Public functions

GenerableDetail<*>

Returns the GenerableDetail for the targetClass.

Public properties

KClass<*>

The class type this provider is for.

Public functions

getGenerableDetail

fun getGenerableDetail(): GenerableDetail<*>

Returns the GenerableDetail for the targetClass.

Public properties

targetClass

val targetClassKClass<*>

The class type this provider is for.