From b7ea0fdd817f8ab31b983d2307edcc2ddbe09dcb Mon Sep 17 00:00:00 2001 From: zaaarf Date: Tue, 23 Jan 2024 11:20:29 +0100 Subject: [PATCH] fix: annotation fields are actually methods --- src/main/java/foo/zaaarf/routecompass/Route.java | 2 ++ src/main/java/foo/zaaarf/routecompass/RouteCompass.java | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/foo/zaaarf/routecompass/Route.java b/src/main/java/foo/zaaarf/routecompass/Route.java index 7c7c091..af66aed 100644 --- a/src/main/java/foo/zaaarf/routecompass/Route.java +++ b/src/main/java/foo/zaaarf/routecompass/Route.java @@ -56,6 +56,8 @@ public class Route { * @param consumes the {@link MediaType} consumed by the endpoint, may be null * @param produces the {@link MediaType} produced by the endpoint, may be null * @param deprecated whether the endpoint is deprecated + * @param returnType the DTO for the response type, may be null + * @param inputType the DTO for the request type, may be null * @param params {@link Param}s of the endpoint, may be null */ public Route(String path, RequestMethod[] methods, MediaType consumes, MediaType produces, diff --git a/src/main/java/foo/zaaarf/routecompass/RouteCompass.java b/src/main/java/foo/zaaarf/routecompass/RouteCompass.java index 58c0d89..a1375e3 100644 --- a/src/main/java/foo/zaaarf/routecompass/RouteCompass.java +++ b/src/main/java/foo/zaaarf/routecompass/RouteCompass.java @@ -288,7 +288,7 @@ public class RouteCompass extends AbstractProcessor { T result = null; for(String fieldName : fieldNames) { - result = (T) annClass.getField(fieldName).get(element.getAnnotation(annClass)); + result = (T) annClass.getMethod(fieldName).invoke(element.getAnnotation(annClass)); if(result != null) return result; }