Skip to content

Commit

Permalink
codeReview Johannes
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan-Thurner committed Aug 17, 2024
1 parent 5acf1a5 commit a760d1f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ private static void printEndpointAnalysisResult() {
}
catch (IOException e) {
logger.error("Failed to deserialize endpoint analysis result", e);
return;
}

endpointsAndMatchingRestCalls.unusedEndpoints().stream().forEach(endpoint -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ private static void parseServerEndpoints(String[] filePaths) {
endpointClasses.add(new EndpointClassInformation(javaClass.getNameAsString(), classRequestMappingString, endpoints));
}
}

}

printFilesFailedToParse(filesFailedToParse);
Expand All @@ -111,11 +110,12 @@ private static void parseServerEndpoints(String[] filePaths) {
* @return a list of EndpointInformation objects representing the extracted endpoint information
*/
private static List<EndpointInformation> extractAnnotationPathValues(ClassOrInterfaceDeclaration javaClass, Set<String> httpMethodClasses, String classRequestMappingString) {
return javaClass.getMethods().stream().flatMap(method -> method.getAnnotations().stream().filter(annotation -> httpMethodClasses.contains(annotation.getNameAsString()))
.flatMap(annotation -> extractPathsFromAnnotation(annotation).stream()
.map(path -> new EndpointInformation(classRequestMappingString, method.getNameAsString(), annotation.getNameAsString(), path, javaClass.getNameAsString(),
method.getBegin().get().line, method.getAnnotations().stream().map(AnnotationExpr::toString).collect(Collectors.toList())))))
.collect(Collectors.toList());
return javaClass.getMethods().stream()
.flatMap(method -> method.getAnnotations().stream().filter(annotation -> httpMethodClasses.contains(annotation.getNameAsString()))
.flatMap(annotation -> extractPathsFromAnnotation(annotation).stream()
.map(path -> new EndpointInformation(classRequestMappingString, method.getNameAsString(), annotation.getNameAsString(), path,
javaClass.getNameAsString(), method.getBegin().get().line, method.getAnnotations().stream().map(AnnotationExpr::toString).toList()))))
.toList();
}

/**
Expand Down

0 comments on commit a760d1f

Please sign in to comment.