org.codeblessing.sourceamazing.builder.api.BuilderApi.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sourceamazing-builder-api Show documentation
Show all versions of sourceamazing-builder-api Show documentation
The API to add data to a sourceamazing model using builders or DSLs.
package org.codeblessing.sourceamazing.builder.api
import org.codeblessing.sourceamazing.schema.api.SchemaContext
import java.util.*
import kotlin.reflect.KClass
object BuilderApi {
fun withBuilder(schemaContext: SchemaContext, inputDefinitionClass: KClass, builderUsage: (builder: I) -> Unit) {
val builderProcessorApis: ServiceLoader = ServiceLoader.load(BuilderProcessorApi::class.java)
val builderProcessorApi = requireNotNull(builderProcessorApis.firstOrNull()) {
"Could not find an implementation of the interface '${BuilderProcessorApi::class}'."
}
builderProcessorApi.withBuilder(schemaContext, inputDefinitionClass, builderUsage)
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy