Skip to content

Commit

Permalink
Fixing Sonar code smells
Browse files Browse the repository at this point in the history
  • Loading branch information
Sashir Estela committed Mar 23, 2024
1 parent b83b08b commit 7b0a775
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,22 +56,19 @@ private void setClassByEventIfExists(Method method) {
Arrays.stream(annotations)
.map(a -> a.annotationType().getDeclaredAnnotation(StreamType.List.class).value())
.findFirst()
.get());
.orElse(null));
} else if (isAnnotationPresent(annotations, StreamType.class)) {
this.classByEvent = calculateClassByEvent(
new StreamType[] { Arrays.stream(annotations)
.map(a -> a.annotationType().getDeclaredAnnotation(StreamType.class))
.findFirst()
.get() });
.orElse(null) });
}
}
}

private boolean isAnnotationPresent(Annotation[] annotations, Class<? extends Annotation> clazz) {
return Arrays.stream(annotations)
.filter(a -> a.annotationType().isAnnotationPresent(clazz))
.findFirst()
.isPresent();
return Arrays.stream(annotations).anyMatch(a -> a.annotationType().isAnnotationPresent(clazz));
}

private Map<String, Class<?>> calculateClassByEvent(StreamType[] streamTypeList) {
Expand Down

0 comments on commit 7b0a775

Please sign in to comment.