camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [5/8] camel git commit: Polished. This closes #898
Date Mon, 14 Mar 2016 19:17:49 GMT
Polished. This closes #898


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/7fbccbb1
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/7fbccbb1
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/7fbccbb1

Branch: refs/heads/master
Commit: 7fbccbb1d4aa7a4cfc4aeae0a85e1e05cc2096dc
Parents: 4748f38
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Mon Mar 14 19:57:07 2016 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Mon Mar 14 20:01:45 2016 +0100

----------------------------------------------------------------------
 .../apache/camel/model/rest/RestDefinition.java | 44 +++++++++++++++-----
 .../apache/camel/model/rest/VerbDefinition.java | 25 +++++------
 2 files changed, 47 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/7fbccbb1/camel-core/src/main/java/org/apache/camel/model/rest/RestDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/rest/RestDefinition.java b/camel-core/src/main/java/org/apache/camel/model/rest/RestDefinition.java
index 2b3baf7..2af693b 100644
--- a/camel-core/src/main/java/org/apache/camel/model/rest/RestDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/rest/RestDefinition.java
@@ -70,6 +70,9 @@ public class RestDefinition extends OptionalIdentifiedDefinition<RestDefinition>
     @XmlAttribute
     private Boolean enableCORS;
 
+    @XmlAttribute
+    private Boolean apiDocs;
+
     @XmlElementRef
     private List<VerbDefinition> verbs = new ArrayList<VerbDefinition>();
 
@@ -176,10 +179,23 @@ public class RestDefinition extends OptionalIdentifiedDefinition<RestDefinition>
         this.enableCORS = enableCORS;
     }
 
+    public Boolean getApiDocs() {
+        return apiDocs;
+    }
+
+    /**
+     * Whether to include or exclude the VerbDefinition in API documentation.
+     * This option will override what may be configured on a parent level
+     * <p/>
+     * The default value is true.
+     */
+    public void setApiDocs(Boolean apiDocs) {
+        this.apiDocs = apiDocs;
+    }
+
     // Fluent API
     //-------------------------------------------------------------------------
 
-
     /**
      * To set the base path of this REST service
      */
@@ -460,6 +476,23 @@ public class RestDefinition extends OptionalIdentifiedDefinition<RestDefinition>
     }
 
     /**
+     * Include or exclude the current Rest Definition in API documentation.
+     * <p/>
+     * The default value is true.
+     */
+    public RestDefinition apiDocs(Boolean apiDocs) {
+        if (getVerbs().isEmpty()) {
+            this.apiDocs = apiDocs;
+        } else {
+            // add on last verb as that is how the Java DSL works
+            VerbDefinition verb = getVerbs().get(getVerbs().size() - 1);
+            verb.setApiDocs(apiDocs);
+        }
+
+        return this;
+    }
+
+    /**
      * Routes directly to the given static endpoint.
      * <p/>
      * If you need additional routing capabilities, then use {@link #route()} instead.
@@ -501,15 +534,6 @@ public class RestDefinition extends OptionalIdentifiedDefinition<RestDefinition>
         return this;
     }
 
-    /**
-     * Include or exclude the current Rest Definition in API documentation
-     */
-    public RestDefinition apiDocs(Boolean apiDocs) {
-        VerbDefinition verb = getVerbs().get(getVerbs().size() - 1);
-        verb.setApiDocs(apiDocs);
-        return this;
-    }
-
     public RouteDefinition route() {
         // add to last verb
         if (getVerbs().isEmpty()) {

http://git-wip-us.apache.org/repos/asf/camel/blob/7fbccbb1/camel-core/src/main/java/org/apache/camel/model/rest/VerbDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/rest/VerbDefinition.java b/camel-core/src/main/java/org/apache/camel/model/rest/VerbDefinition.java
index 2c33f8e..744a99c 100644
--- a/camel-core/src/main/java/org/apache/camel/model/rest/VerbDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/rest/VerbDefinition.java
@@ -254,6 +254,19 @@ public class VerbDefinition extends OptionalIdentifiedDefinition<VerbDefinition>
         this.routeId = routeId;
     }
 
+    public Boolean getApiDocs() {
+        return apiDocs;
+    }
+
+    /**
+     * Whether to include or exclude the VerbDefinition in API documentation.
+     * <p/>
+     * The default value is true.
+     */
+    public void setApiDocs(Boolean apiDocs) {
+        this.apiDocs = apiDocs;
+    }
+
     public RestDefinition getRest() {
         return rest;
     }
@@ -371,18 +384,6 @@ public class VerbDefinition extends OptionalIdentifiedDefinition<VerbDefinition>
         return rest.verb(verb, uri);
     }
 
-    public Boolean getApiDocs() {
-        return apiDocs;
-    }
-
-    /**
-     * Whether to include or exclude the VerbDefinition in API documentation.
-     * The default value is true.
-     */
-    public void setApiDocs(Boolean apiDocs) {
-        this.apiDocs = apiDocs;
-    }
-
     public String asVerb() {
         // we do not want the jaxb model to repeat itself, by outputting <get method="get">
         // so we defer the verb from the instance type


Mime
View raw message