# GenerableProvider


```
public interface GenerableProvider
```

<br />

*** ** * ** ***

Interface used by the `https://developer.android.com/reference/java/util/ServiceLoader.html` 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 `https://developers.google.com/android/reference/com/google/mlkit/genai/schema/guided/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 @https://developer.android.com/reference/androidx/annotation/NonNull.html https://developers.google.com/android/reference/com/google/mlkit/genai/schema/guided/GenerableDetail<@https://developer.android.com/reference/androidx/annotation/NonNull.html ?>` | `https://developers.google.com/android/reference/com/google/mlkit/genai/schema/guided/GenerableProvider#getGenerableDetail()()` Returns the `https://developers.google.com/android/reference/com/google/mlkit/genai/schema/guided/GenerableDetail` for the `https://developers.google.com/android/reference/com/google/mlkit/genai/schema/guided/GenerableProvider#targetClass()`. |
| `abstract @https://developer.android.com/reference/androidx/annotation/NonNull.html https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.reflect/-k-class/index.html<@https://developer.android.com/reference/androidx/annotation/NonNull.html ?>` | `https://developers.google.com/android/reference/com/google/mlkit/genai/schema/guided/GenerableProvider#getTargetClass()()` The class type this provider is for. |

## Public methods

### getGenerableDetail

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

Returns the `https://developers.google.com/android/reference/com/google/mlkit/genai/schema/guided/GenerableDetail` for the `https://developers.google.com/android/reference/com/google/mlkit/genai/schema/guided/GenerableProvider#targetClass()`.

### getTargetClass

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

The class type this provider is for.