camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zregv...@apache.org
Subject [camel] branch master updated: CAMEL-12826: Add missing documentation in camel...
Date Fri, 21 Sep 2018 12:58:53 GMT
This is an automated email from the ASF dual-hosted git repository.

zregvart pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/master by this push:
     new 57533d4  CAMEL-12826: Add missing documentation in camel...
57533d4 is described below

commit 57533d4cf076ef0c1dc239fa1bc3085ee02297b4
Author: Zoran Regvart <zregvart@apache.org>
AuthorDate: Fri Sep 21 14:58:50 2018 +0200

    CAMEL-12826: Add missing documentation in camel...
    
    ...-grape and skip Groovy `metaClass` property in APT
    
    This adds documentation reported missing by the
    `camel-package:validate-components`. Also ignores the Groovy `metaClass`
    property added by the Groovy compiler.
---
 .../camel-grape/src/main/docs/grape-component.adoc | 18 ++++++++++++-----
 .../camel/component/grape/GrapeComponent.groovy    |  2 ++
 .../camel/component/grape/GrapeEndpoint.groovy     |  2 +-
 .../tools/apt/EndpointAnnotationProcessor.java     | 23 ++++++++++++++++++++++
 4 files changed, 39 insertions(+), 6 deletions(-)

diff --git a/components/camel-grape/src/main/docs/grape-component.adoc b/components/camel-grape/src/main/docs/grape-component.adoc
index e319662..2f3644a 100644
--- a/components/camel-grape/src/main/docs/grape-component.adoc
+++ b/components/camel-grape/src/main/docs/grape-component.adoc
@@ -13,7 +13,16 @@ without the restart of the router.
 ### Grape options
 
 // component options: START
-The Grape component has no options.
+The Grape component supports 2 options, which are listed below.
+
+
+
+[width="100%",cols="2,5,^1,2",options="header"]
+|===
+| Name | Description | Default | Type
+| *patchesRepository* (advanced) | Implementation of org.apache.camel.component.grape.PatchesRepository,
by default: FilePatchesRepository |  | PatchesRepository
+| *resolveProperty Placeholders* (advanced) | Whether the component should resolve property
placeholders on itself when starting. Only properties which are of String type can use property
placeholders. | true | boolean
+|===
 // component options: END
 
 
@@ -32,18 +41,17 @@ with the following path and query parameters:
 [width="100%",cols="2,5,^1,2",options="header"]
 |===
 | Name | Description | Default | Type
-| *defaultCoordinates* | *Required* Maven coordinates to use as default to grab if the message
body is empty. |  | String
+| *defaultCoordinates* | *Required* Maven coordinates to use as default to grab if the message
body is empty |  | String
 |===
 
 
-==== Query Parameters (2 parameters):
+==== Query Parameters (1 parameters):
 
 
 [width="100%",cols="2,5,^1,2",options="header"]
 |===
 | Name | Description | Default | Type
-| *exchangePattern* () | Sets the default exchange pattern when creating an exchange. | InOnly
| ExchangePattern
-| *synchronous* () | Sets whether synchronous processing should be strictly used or Camel
is allowed to use asynchronous processing (if supported). | false | boolean
+| *synchronous* (advanced) | Sets whether synchronous processing should be strictly used,
or Camel is allowed to use asynchronous processing (if supported). | false | boolean
 |===
 // endpoint options: END
 
diff --git a/components/camel-grape/src/main/groovy/org/apache/camel/component/grape/GrapeComponent.groovy
b/components/camel-grape/src/main/groovy/org/apache/camel/component/grape/GrapeComponent.groovy
index 5a4dd51..9596da1 100644
--- a/components/camel-grape/src/main/groovy/org/apache/camel/component/grape/GrapeComponent.groovy
+++ b/components/camel-grape/src/main/groovy/org/apache/camel/component/grape/GrapeComponent.groovy
@@ -18,9 +18,11 @@ package org.apache.camel.component.grape
 
 import org.apache.camel.CamelContext
 import org.apache.camel.impl.UriEndpointComponent
+import org.apache.camel.spi.Metadata
 
 class GrapeComponent extends UriEndpointComponent {
 
+	@Metadata(label = "advanced", description = "Implementation of org.apache.camel.component.grape.PatchesRepository,
by default: FilePatchesRepository")
     private PatchesRepository patchesRepository = new FilePatchesRepository()
 
     GrapeComponent() {
diff --git a/components/camel-grape/src/main/groovy/org/apache/camel/component/grape/GrapeEndpoint.groovy
b/components/camel-grape/src/main/groovy/org/apache/camel/component/grape/GrapeEndpoint.groovy
index aa58b43..0686a4f 100644
--- a/components/camel-grape/src/main/groovy/org/apache/camel/component/grape/GrapeEndpoint.groovy
+++ b/components/camel-grape/src/main/groovy/org/apache/camel/component/grape/GrapeEndpoint.groovy
@@ -34,7 +34,7 @@ import static org.apache.camel.component.grape.MavenCoordinates.parseMavenCoordi
 @UriEndpoint(firstVersion = "2.16.0", scheme = "grape", syntax = "grape:defaultCoordinates",
title = "Grape", producerOnly = true, label = "management,deployment")
 class GrapeEndpoint extends DefaultEndpoint {
 
-    @UriPath @Metadata(required = "true")
+    @UriPath(description = "Maven coordinates to use as default to grab if the message body
is empty") @Metadata(required = "true")
     private final String defaultCoordinates
 
     GrapeEndpoint(String endpointUri, String defaultCoordinates, GrapeComponent component)
{
diff --git a/tooling/apt/src/main/java/org/apache/camel/tools/apt/EndpointAnnotationProcessor.java
b/tooling/apt/src/main/java/org/apache/camel/tools/apt/EndpointAnnotationProcessor.java
index 049213f..3726d83 100644
--- a/tooling/apt/src/main/java/org/apache/camel/tools/apt/EndpointAnnotationProcessor.java
+++ b/tooling/apt/src/main/java/org/apache/camel/tools/apt/EndpointAnnotationProcessor.java
@@ -25,6 +25,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Objects;
 import java.util.Set;
+
 import javax.annotation.processing.AbstractProcessor;
 import javax.annotation.processing.RoundEnvironment;
 import javax.annotation.processing.SupportedAnnotationTypes;
@@ -34,6 +35,7 @@ import javax.lang.model.element.ElementKind;
 import javax.lang.model.element.ExecutableElement;
 import javax.lang.model.element.TypeElement;
 import javax.lang.model.element.VariableElement;
+import javax.lang.model.type.DeclaredType;
 import javax.lang.model.type.TypeKind;
 import javax.lang.model.type.TypeMirror;
 import javax.lang.model.util.ElementFilter;
@@ -473,6 +475,10 @@ public class EndpointAnnotationProcessor extends AbstractProcessor {
                     continue;
                 }
 
+                if (isGroovyMetaClassProperty(method)) {
+                    continue;
+                }
+
                 // must be a getter/setter pair
                 String fieldName = methodName.substring(3);
                 fieldName = fieldName.substring(0, 1).toLowerCase() + fieldName.substring(1);
@@ -811,4 +817,21 @@ public class EndpointAnnotationProcessor extends AbstractProcessor {
 
     // CHECKSTYLE:ON
 
+    private static boolean isGroovyMetaClassProperty(final ExecutableElement method) {
+        final String methodName = method.getSimpleName().toString();
+        
+        if (!"setMetaClass".equals(methodName)) {
+            return false;
+        }
+
+        if (method.getReturnType() instanceof DeclaredType) {
+            final DeclaredType returnType = (DeclaredType) method.getReturnType();
+
+            return "groovy.lang.MetaClass".equals(returnType.asElement().getSimpleName());
+        } else {
+            // Eclipse (Groovy?) compiler returns javax.lang.model.type.NoType, no other
way to check but to look at toString output
+            return method.toString().contains("(groovy.lang.MetaClass)");
+        }
+    }
+
 }


Mime
View raw message