xyz.block.ftl.deployment.SchemaContributorBuildItem Maven / Gradle / Ivy
package xyz.block.ftl.deployment;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;
import io.quarkus.builder.item.MultiBuildItem;
import xyz.block.ftl.v1.schema.Decl;
/**
* A build item that contributes information to the final Schema
*/
public final class SchemaContributorBuildItem extends MultiBuildItem {
final Consumer schemaContributor;
public SchemaContributorBuildItem(Consumer schemaContributor) {
this.schemaContributor = schemaContributor;
}
public SchemaContributorBuildItem(List decls) {
var data = new ArrayList<>(decls);
this.schemaContributor = new Consumer() {
@Override
public void accept(ModuleBuilder moduleBuilder) {
for (var i : data) {
moduleBuilder.addDecls(i);
}
}
};
}
public Consumer getSchemaContributor() {
return schemaContributor;
}
}