use of io.quarkus.arc.deployment.AnnotationsTransformerBuildItem in project kogito-runtimes by kiegroup.
the class KogitoProcessMessagingProcessor method annotate.
@BuildStep
AnnotationsTransformerBuildItem annotate(KogitoMessagingMetadataBuildItem messagingMetadata) {
Map<DotName, DotName> fieldMapping = new HashMap<>();
Map<DotName, DotName> classMapping = new HashMap<>();
for (Entry<DotName, EventGenerator> entry : messagingMetadata.generators().entrySet()) {
DotName annotationName = DotNamesHelper.createAnnotationName(entry.getValue());
fieldMapping.put(entry.getKey(), annotationName);
classMapping.put(DotNamesHelper.createClassName(entry.getValue()), annotationName);
}
return new AnnotationsTransformerBuildItem(new MessagingAnnotationTransfomer(fieldMapping, classMapping));
}
use of io.quarkus.arc.deployment.AnnotationsTransformerBuildItem in project quarkus-github-app by quarkiverse.
the class GitHubAppProcessor method generateClasses.
@BuildStep
void generateClasses(CombinedIndexBuildItem combinedIndex, LaunchModeBuildItem launchMode, BuildProducer<AdditionalBeanBuildItem> additionalBeans, BuildProducer<GeneratedBeanBuildItem> generatedBeans, BuildProducer<GeneratedClassBuildItem> generatedClasses, BuildProducer<ReflectiveClassBuildItem> reflectiveClasses, BuildProducer<AnnotationsTransformerBuildItem> annotationsTransformer) {
Collection<EventDefinition> allEventDefinitions = getAllEventDefinitions(combinedIndex.getIndex());
// Add @Vetoed to all the user-defined event listening classes
annotationsTransformer.produce(new AnnotationsTransformerBuildItem(new VetoUserDefinedEventListeningClassesAnnotationsTransformer(allEventDefinitions.stream().map(d -> d.getAnnotation()).collect(Collectors.toSet()))));
// Add the qualifiers as beans
String[] subscriberAnnotations = allEventDefinitions.stream().map(d -> d.getAnnotation().toString()).toArray(String[]::new);
additionalBeans.produce(new AdditionalBeanBuildItem(subscriberAnnotations));
DispatchingConfiguration dispatchingConfiguration = getDispatchingConfiguration(combinedIndex.getIndex(), allEventDefinitions);
ClassOutput classOutput = new GeneratedClassGizmoAdaptor(generatedClasses, true);
generateAnnotationLiterals(classOutput, dispatchingConfiguration);
ClassOutput beanClassOutput = new GeneratedBeanGizmoAdaptor(generatedBeans);
generateDispatcher(beanClassOutput, combinedIndex, launchMode, dispatchingConfiguration, reflectiveClasses);
generateMultiplexers(beanClassOutput, dispatchingConfiguration, reflectiveClasses);
}
use of io.quarkus.arc.deployment.AnnotationsTransformerBuildItem in project camel-quarkus by apache.
the class ConsumeProcessor method annotationsTransformers.
@BuildStep
void annotationsTransformers(BuildProducer<AnnotationsTransformerBuildItem> annotationsTransformers) {
annotationsTransformers.produce(new AnnotationsTransformerBuildItem(new AnnotationsTransformer() {
public boolean appliesTo(org.jboss.jandex.AnnotationTarget.Kind kind) {
return kind == Kind.CLASS;
}
@Override
public void transform(TransformationContext ctx) {
final ClassInfo classInfo = ctx.getTarget().asClass();
if (hasConsumeMethod(classInfo)) {
/* If there is @Consume on a method, make the declaring class a named injectable bean */
String beanName = namedValue(classInfo);
final Transformation transform = ctx.transform();
if (!classInfo.annotations().keySet().stream().anyMatch(BEAN_DEFINING_ANNOTATIONS::contains)) {
/* Only add @Singleton if there is no other bean defining annotation yet */
transform.add(Singleton.class);
}
if (beanName == null) {
beanName = ConsumeProcessor.uniqueBeanName(classInfo);
transform.add(Named.class, AnnotationValue.createStringValue("value", beanName));
}
transform.done();
}
}
}));
}
use of io.quarkus.arc.deployment.AnnotationsTransformerBuildItem in project quarkus-github-action by quarkiverse.
the class GitHubActionProcessor method generateClasses.
@BuildStep
void generateClasses(CombinedIndexBuildItem combinedIndex, LaunchModeBuildItem launchMode, BuildProducer<AdditionalBeanBuildItem> additionalBeans, BuildProducer<GeneratedBeanBuildItem> generatedBeans, BuildProducer<GeneratedClassBuildItem> generatedClasses, BuildProducer<ReflectiveClassBuildItem> reflectiveClasses, BuildProducer<AnnotationsTransformerBuildItem> annotationsTransformer) {
Collection<EventDefinition> allEventDefinitions = getAllEventDefinitions(combinedIndex.getIndex());
// Add @Vetoed to all the user-defined event listening classes
annotationsTransformer.produce(new AnnotationsTransformerBuildItem(new VetoUserDefinedEventListeningClassesAnnotationsTransformer(allEventDefinitions.stream().map(d -> d.getAnnotation()).collect(Collectors.toSet()))));
// Add the qualifiers as beans
String[] subscriberAnnotations = allEventDefinitions.stream().map(d -> d.getAnnotation().toString()).toArray(String[]::new);
additionalBeans.produce(new AdditionalBeanBuildItem(subscriberAnnotations));
additionalBeans.produce(new AdditionalBeanBuildItem(Action.class));
DispatchingConfiguration dispatchingConfiguration = getDispatchingConfiguration(combinedIndex.getIndex(), allEventDefinitions);
ClassOutput classOutput = new GeneratedClassGizmoAdaptor(generatedClasses, true);
generateAnnotationLiterals(classOutput, dispatchingConfiguration);
ClassOutput beanClassOutput = new GeneratedBeanGizmoAdaptor(generatedBeans);
generatePayloadTypeResolver(beanClassOutput, reflectiveClasses, allEventDefinitions);
generateActionMain(beanClassOutput, combinedIndex, launchMode, dispatchingConfiguration, reflectiveClasses);
generateMultiplexers(beanClassOutput, dispatchingConfiguration, reflectiveClasses);
}
Aggregations