diff options
author | zaaarf <me@zaaarf.foo> | 2024-01-19 15:07:38 +0100 |
---|---|---|
committer | zaaarf <me@zaaarf.foo> | 2024-01-19 15:07:38 +0100 |
commit | ef3529336c64042f27f7a433d4ceb1990f5fb2d7 (patch) | |
tree | 64c43214f0433aafa5616286b07586506558fa00 /src/main/java/foo/zaaarf/routecompass/Route.java | |
parent | 4da7e5990d6d932539d35082a4859a5d10d46bc6 (diff) |
feat: implemented printing and media types
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; } } |