diff options
Diffstat (limited to 'src/main/java/foo/zaaarf/routecompass/Route.java')
-rw-r--r-- | src/main/java/foo/zaaarf/routecompass/Route.java | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/main/java/foo/zaaarf/routecompass/Route.java b/src/main/java/foo/zaaarf/routecompass/Route.java index 2b61571..ade19a6 100644 --- a/src/main/java/foo/zaaarf/routecompass/Route.java +++ b/src/main/java/foo/zaaarf/routecompass/Route.java @@ -1,20 +1,21 @@ package foo.zaaarf.routecompass; +import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.RequestMethod; /** * Internal representation of a REST route. */ public class Route { - public final String classFqn; public final String route; public final String method; + public final String produces; + public final String consumes; public final boolean deprecated; - - public Route(String classFqn, String route, RequestMethod[] methods, boolean deprecated) { - this.classFqn = classFqn; + public Route(String route, RequestMethod[] methods, MediaType consumes, MediaType produces, boolean deprecated) { this.route = route; + StringBuilder methodStringBuilder = new StringBuilder("["); for(RequestMethod m : methods) methodStringBuilder @@ -24,6 +25,13 @@ public class Route { .deleteCharAt(methodStringBuilder.length() - 1) .append("]"); this.method = methodStringBuilder.toString(); + + if(produces != null) this.produces = produces.toString(); + else this.produces = null; + + if(consumes != null) this.consumes = consumes.toString(); + else this.consumes = null; + this.deprecated = deprecated; } } |