All Downloads are FREE. Search and download functionalities are using the official Maven repository.

xyz.block.ftl.deployment.SchemaContributorBuildItem Maven / Gradle / Ivy

There is a newer version: 0.398.1
Show newest version
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;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy