You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2016/03/14 20:17:51 UTC
[7/8] camel git commit: Polished. This closes #898
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/dc677b1f
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/dc677b1f
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/dc677b1f
Branch: refs/heads/camel-2.16.x
Commit: dc677b1fca23c21aecba4e8ac2060fb0d64e41af
Parents: 8f1c63f
Author: Claus Ibsen <da...@apache.org>
Authored: Mon Mar 14 19:57:07 2016 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Mon Mar 14 20:17:27 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/dc677b1f/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 cfe7a23..88e06f9 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
@@ -68,6 +68,9 @@ public class RestDefinition extends OptionalIdentifiedDefinition<RestDefinition>
@XmlAttribute
private Boolean enableCORS;
+ @XmlAttribute
+ private Boolean apiDocs;
+
@XmlElementRef
private List<VerbDefinition> verbs = new ArrayList<VerbDefinition>();
@@ -174,10 +177,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
*/
@@ -456,6 +472,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.
@@ -497,15 +530,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/dc677b1f/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