Skip to content

Commit

Permalink
Merge pull request #31835 from mkouba/arc-TransformedAnnotationsBuild…
Browse files Browse the repository at this point in the history
…Item-hasAnnotation

ArC - add TransformedAnnotationsBuildItem#hasAnnotation()
  • Loading branch information
gsmet authored Mar 14, 2023
2 parents bc39d8a + b15bb56 commit e514edc
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.quarkus.arc.deployment;

import java.lang.annotation.Annotation;
import java.util.Collection;
import java.util.function.Function;

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

public AnnotationInstance getAnnotation(AnnotationTarget target, DotName name) {
return beanDeployment.getAnnotation(target, name);
public AnnotationInstance getAnnotation(AnnotationTarget target, DotName annotationName) {
return beanDeployment.getAnnotation(target, annotationName);
}

public AnnotationInstance getAnnotation(AnnotationTarget target, Class<? extends Annotation> annotationClass) {
return getAnnotation(target, DotName.createSimple(annotationClass));
}

public boolean hasAnnotation(AnnotationTarget target, DotName annotationName) {
return beanDeployment.hasAnnotation(target, annotationName);
}

public boolean hasAnnotation(AnnotationTarget target, Class<? extends Annotation> annotationClass) {
return hasAnnotation(target, DotName.createSimple(annotationClass));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ void collectScheduledMethods(BeanArchiveIndexBuildItem beanArchives, BeanDiscove
MethodInfo method = annotationInstance.target().asMethod();
if (Modifier.isStatic(method.flags()) && !KotlinUtil.isSuspendMethod(method)) {
scheduledBusinessMethods.produce(new ScheduledBusinessMethodItem(null, method, schedules,
transformedAnnotations.getAnnotation(method, SchedulerDotNames.NON_BLOCKING) != null));
transformedAnnotations.hasAnnotation(method, SchedulerDotNames.NON_BLOCKING)));
LOGGER.debugf("Found scheduled static method %s declared on %s", method, method.declaringClass().name());
}
}
Expand Down Expand Up @@ -183,7 +183,7 @@ private void collectScheduledMethods(IndexView index, TransformedAnnotationsBuil
}
if (schedules != null) {
scheduledBusinessMethods.produce(new ScheduledBusinessMethodItem(bean, method, schedules,
transformedAnnotations.getAnnotation(method, SchedulerDotNames.NON_BLOCKING) != null));
transformedAnnotations.hasAnnotation(method, SchedulerDotNames.NON_BLOCKING)));
LOGGER.debugf("Found scheduled business method %s declared on %s", method, bean);
}
}
Expand Down

0 comments on commit e514edc

Please sign in to comment.