Skip to content

Commit

Permalink
Added a step to model checking.Check if the annotated class collectio…
Browse files Browse the repository at this point in the history
…n obtained is empty.
  • Loading branch information
Doom9527 committed Apr 4, 2024
1 parent 57e7a98 commit 5e3c61c
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,17 @@ public Set<Class<?>> getAnnotatedClasses(Package toScan, Class<? extends Annotat

@Override
public Set<Class<?>> getAnnotatedClasses(String packageName, Class<? extends Annotation> annotation) {
return startupCache.get(annotation.getCanonicalName()).stream()
.filter(clazz ->
clazz.getPackage().getName().equals(packageName)
|| clazz.getPackage().getName().startsWith(packageName + "."))
LinkedHashSet<Class<?>> annotatedClasses = startupCache.get(annotation.getCanonicalName()).stream()
.filter(clazz -> clazz.getPackage().getName().equals(packageName)
|| clazz.getPackage().getName().startsWith(packageName + "."))
.collect(Collectors.toCollection(LinkedHashSet::new));

// Check if the annotated class collection obtained is empty
if (annotatedClasses.isEmpty()) {
throw new IllegalArgumentException("No annotated classes found in the specified package: " + packageName);
}

return annotatedClasses;
}

@Override
Expand Down

0 comments on commit 5e3c61c

Please sign in to comment.