Skip to content

Commit e514edc

Browse files
authored
Merge pull request #31835 from mkouba/arc-TransformedAnnotationsBuildItem-hasAnnotation
ArC - add TransformedAnnotationsBuildItem#hasAnnotation()
2 parents bc39d8a + b15bb56 commit e514edc

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/TransformedAnnotationsBuildItem.java

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package io.quarkus.arc.deployment;
22

3+
import java.lang.annotation.Annotation;
34
import java.util.Collection;
45
import java.util.function.Function;
56

@@ -29,8 +30,20 @@ public Collection<AnnotationInstance> getAnnotations(AnnotationTarget target) {
2930
return beanDeployment.getAnnotations(target);
3031
}
3132

32-
public AnnotationInstance getAnnotation(AnnotationTarget target, DotName name) {
33-
return beanDeployment.getAnnotation(target, name);
33+
public AnnotationInstance getAnnotation(AnnotationTarget target, DotName annotationName) {
34+
return beanDeployment.getAnnotation(target, annotationName);
35+
}
36+
37+
public AnnotationInstance getAnnotation(AnnotationTarget target, Class<? extends Annotation> annotationClass) {
38+
return getAnnotation(target, DotName.createSimple(annotationClass));
39+
}
40+
41+
public boolean hasAnnotation(AnnotationTarget target, DotName annotationName) {
42+
return beanDeployment.hasAnnotation(target, annotationName);
43+
}
44+
45+
public boolean hasAnnotation(AnnotationTarget target, Class<? extends Annotation> annotationClass) {
46+
return hasAnnotation(target, DotName.createSimple(annotationClass));
3447
}
3548

3649
@Override

extensions/scheduler/deployment/src/main/java/io/quarkus/scheduler/deployment/SchedulerProcessor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ void collectScheduledMethods(BeanArchiveIndexBuildItem beanArchives, BeanDiscove
143143
MethodInfo method = annotationInstance.target().asMethod();
144144
if (Modifier.isStatic(method.flags()) && !KotlinUtil.isSuspendMethod(method)) {
145145
scheduledBusinessMethods.produce(new ScheduledBusinessMethodItem(null, method, schedules,
146-
transformedAnnotations.getAnnotation(method, SchedulerDotNames.NON_BLOCKING) != null));
146+
transformedAnnotations.hasAnnotation(method, SchedulerDotNames.NON_BLOCKING)));
147147
LOGGER.debugf("Found scheduled static method %s declared on %s", method, method.declaringClass().name());
148148
}
149149
}
@@ -183,7 +183,7 @@ private void collectScheduledMethods(IndexView index, TransformedAnnotationsBuil
183183
}
184184
if (schedules != null) {
185185
scheduledBusinessMethods.produce(new ScheduledBusinessMethodItem(bean, method, schedules,
186-
transformedAnnotations.getAnnotation(method, SchedulerDotNames.NON_BLOCKING) != null));
186+
transformedAnnotations.hasAnnotation(method, SchedulerDotNames.NON_BLOCKING)));
187187
LOGGER.debugf("Found scheduled business method %s declared on %s", method, bean);
188188
}
189189
}

0 commit comments

Comments
 (0)