Skip to content

Commit

Permalink
Merge pull request #19324 from johnaohara/19323
Browse files Browse the repository at this point in the history
Efficient scan of jandex index for Spring JPA Annotations
  • Loading branch information
gsmet authored Aug 10, 2021
2 parents cde75bc + 1b56fa8 commit 0d33b51
Showing 1 changed file with 7 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@
import java.util.List;
import java.util.Set;
import java.util.regex.Pattern;
import java.util.stream.Collectors;

import org.eclipse.microprofile.config.Config;
import org.eclipse.microprofile.config.ConfigProvider;
import org.jboss.jandex.AnnotationInstance;
import org.jboss.jandex.AnnotationTarget;
import org.jboss.jandex.AnnotationTarget.Kind;
import org.jboss.jandex.ClassInfo;
import org.jboss.jandex.DotName;
import org.jboss.jandex.IndexView;
Expand Down Expand Up @@ -232,20 +234,11 @@ private List<ClassInfo> getAllInterfacesExtending(Collection<DotName> targets, I
}

private Collection<DotName> getAllNoRepositoryBeanInterfaces(IndexView index) {
Set<DotName> result = new HashSet<>();
Collection<ClassInfo> knownClasses = index.getKnownClasses();
for (ClassInfo clazz : knownClasses) {
if (!Modifier.isInterface(clazz.flags())) {
continue;
}
boolean found = false;
for (ClassInfo classInfo : knownClasses) {
if (classInfo.classAnnotation(DotNames.SPRING_DATA_NO_REPOSITORY_BEAN) != null) {
result.add(classInfo.name());
}
}
}
return result;
return index.getAnnotations(DotNames.SPRING_DATA_NO_REPOSITORY_BEAN).stream()
.filter(ai -> ai.target().kind() == Kind.CLASS)
.filter(ai -> Modifier.isInterface(ai.target().asClass().flags()))
.map(ai -> ai.target().asClass().name())
.collect(Collectors.toSet());
}

// generate a concrete class that will be used by Arc to resolve injection points
Expand Down

0 comments on commit 0d33b51

Please sign in to comment.