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

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

There is a newer version: 0.398.1
Show newest version
package xyz.block.ftl.deployment;

import java.util.Map;

import org.jboss.jandex.AnnotationInstance;
import org.jboss.jandex.AnnotationValue;
import org.jboss.jandex.DotName;

import io.quarkus.builder.item.SimpleBuildItem;

public final class SubscriptionMetaAnnotationsBuildItem extends SimpleBuildItem {

    private final Map annotations;

    public SubscriptionMetaAnnotationsBuildItem(Map annotations) {
        this.annotations = annotations;
    }

    public Map getAnnotations() {
        return annotations;
    }

    public record SubscriptionAnnotation(String module, String topic, String name) {
    }

    public static SubscriptionAnnotation fromJandex(AnnotationInstance subscriptions, String currentModuleName) {
        AnnotationValue moduleValue = subscriptions.value("module");

        return new SubscriptionMetaAnnotationsBuildItem.SubscriptionAnnotation(
                moduleValue == null || moduleValue.asString().isEmpty() ? currentModuleName
                        : moduleValue.asString(),
                subscriptions.value("topic").asString(),
                subscriptions.value("name").asString());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy