GenerableProvider

public 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 methods

abstract @NonNull GenerableDetail<@NonNull ?>

Returns the GenerableDetail for the targetClass.

abstract @NonNull KClass<@NonNull ?>

The class type this provider is for.

Public methods

getGenerableDetail

abstract @NonNull GenerableDetail<@NonNull ?> getGenerableDetail()

Returns the GenerableDetail for the targetClass.

getTargetClass

abstract @NonNull KClass<@NonNull ?> getTargetClass()

The class type this provider is for.