Quantcast

camel git commit: CAMEL-11165 Add @Generated annotation to code g...

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

camel git commit: CAMEL-11165 Add @Generated annotation to code g...

zregvart
Repository: camel
Updated Branches:
  refs/heads/master b3ac9932f -> 110d1c9d6


CAMEL-11165 Add @Generated annotation to code g...

...enerated by SpringBootAutoConfigurationMojo

Adds `@Generated` annotation to Spring Boot auto-configuration generated
source files.


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

Branch: refs/heads/master
Commit: 110d1c9d6acf386bceed3e6b2f5f6e2046607236
Parents: b3ac993
Author: Zoran Regvart <[hidden email]>
Authored: Tue Apr 18 16:31:08 2017 +0200
Committer: Zoran Regvart <[hidden email]>
Committed: Tue Apr 18 16:35:27 2017 +0200

----------------------------------------------------------------------
 .../SpringBootAutoConfigurationMojo.java        | 26 ++++++++++++++++++++
 1 file changed, 26 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/110d1c9d/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootAutoConfigurationMojo.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootAutoConfigurationMojo.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootAutoConfigurationMojo.java
index d7eac27..a2f5fcd 100644
--- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootAutoConfigurationMojo.java
+++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootAutoConfigurationMojo.java
@@ -27,6 +27,7 @@ import java.lang.reflect.Modifier;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.net.URLClassLoader;
+import java.time.Instant;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
@@ -42,6 +43,8 @@ import java.util.TreeSet;
 import java.util.regex.Pattern;
 import java.util.stream.Collectors;
 
+import javax.annotation.Generated;
+
 import com.google.gson.Gson;
 import com.google.gson.GsonBuilder;
 import org.apache.camel.maven.packaging.model.ComponentModel;
@@ -289,6 +292,8 @@ public class SpringBootAutoConfigurationMojo extends AbstractMojo {
             doc = model.getDescription() + "\n\n" + doc;
         }
         commonClass.getJavaDoc().setFullText(doc);
+        commonClass.addAnnotation(Generated.class).setStringValue("value", SpringBootAutoConfigurationMojo.class.getName())
+        .setStringValue("date", Instant.now().toString());
 
         for (OtherOptionModel option : model.getOptions()) {
             String type = option.getJavaType();
@@ -334,6 +339,8 @@ public class SpringBootAutoConfigurationMojo extends AbstractMojo {
             configClass.setPackage(packageName);
             configClass.setName(configName);
             configClass.extendSuperType(commonClass);
+            configClass.addAnnotation(Generated.class).setStringValue("value", SpringBootAutoConfigurationMojo.class.getName())
+            .setStringValue("date", Instant.now().toString());
             configClass.addAnnotation("org.springframework.boot.context.properties.ConfigurationProperties").setStringValue("prefix", propertiesPrefix);
             configClass.addImport(Map.class);
             configClass.addImport(HashMap.class);
@@ -383,6 +390,8 @@ public class SpringBootAutoConfigurationMojo extends AbstractMojo {
         JavaClassSource javaClass = Roaster.create(JavaClassSource.class);
         javaClass.setPackage(packageName);
         javaClass.setName(className);
+        javaClass.addAnnotation(Generated.class).setStringValue("value", SpringBootAutoConfigurationMojo.class.getName())
+        .setStringValue("date", Instant.now().toString());
         javaClass.addAnnotation("org.springframework.boot.context.properties.ConfigurationProperties").setStringValue("prefix", propertiesPrefix);
 
         String doc = "Generated by camel-package-maven-plugin - do not edit this file!";
@@ -446,6 +455,8 @@ public class SpringBootAutoConfigurationMojo extends AbstractMojo {
         String doc = "Generated by camel-package-maven-plugin - do not edit this file!";
         javaClass.getJavaDoc().setFullText(doc);
 
+        javaClass.addAnnotation(Generated.class).setStringValue("value", SpringBootAutoConfigurationMojo.class.getName())
+        .setStringValue("date", Instant.now().toString());
         javaClass.addAnnotation(Configuration.class);
         javaClass.addAnnotation(ConditionalOnBean.class).setStringValue("type", "org.apache.camel.spring.boot.CamelAutoConfiguration");
         javaClass.addAnnotation(ConditionalOnProperty.class).setStringValue("name", "camel.rest.enabled").setLiteralValue("matchIfMissing", "true");
@@ -670,6 +681,8 @@ public class SpringBootAutoConfigurationMojo extends AbstractMojo {
         String prefix = "camel.component." + (overrideComponentName != null ? overrideComponentName : model.getScheme());
         // make sure prefix is in lower case
         prefix = prefix.toLowerCase(Locale.US);
+        javaClass.addAnnotation(Generated.class).setStringValue("value", SpringBootAutoConfigurationMojo.class.getName())
+        .setStringValue("date", Instant.now().toString());
         javaClass.addAnnotation("org.springframework.boot.context.properties.ConfigurationProperties").setStringValue("prefix", prefix);
 
         Set<JavaClassSource> nestedTypes = new HashSet<>();
@@ -1021,6 +1034,8 @@ public class SpringBootAutoConfigurationMojo extends AbstractMojo {
         String prefix = "camel.dataformat." + (overrideDataFormatName != null ? overrideDataFormatName : model.getName());
         // make sure prefix is in lower case
         prefix = prefix.toLowerCase(Locale.US);
+        javaClass.addAnnotation(Generated.class).setStringValue("value", SpringBootAutoConfigurationMojo.class.getName())
+        .setStringValue("date", Instant.now().toString());
         javaClass.addAnnotation("org.springframework.boot.context.properties.ConfigurationProperties").setStringValue("prefix", prefix);
 
         for (DataFormatOptionModel option : model.getDataFormatOptions()) {
@@ -1083,6 +1098,8 @@ public class SpringBootAutoConfigurationMojo extends AbstractMojo {
         String prefix = "camel.language." + (overrideLanguageName != null ? overrideLanguageName : model.getName());
         // make sure prefix is in lower case
         prefix = prefix.toLowerCase(Locale.US);
+        javaClass.addAnnotation(Generated.class).setStringValue("value", SpringBootAutoConfigurationMojo.class.getName())
+        .setStringValue("date", Instant.now().toString());
         javaClass.addAnnotation("org.springframework.boot.context.properties.ConfigurationProperties").setStringValue("prefix", prefix);
 
         for (LanguageOptionModel option : model.getLanguageOptions()) {
@@ -1172,6 +1189,8 @@ public class SpringBootAutoConfigurationMojo extends AbstractMojo {
         String doc = "Generated by camel-package-maven-plugin - do not edit this file!";
         javaClass.getJavaDoc().setFullText(doc);
 
+        javaClass.addAnnotation(Generated.class).setStringValue("value", SpringBootAutoConfigurationMojo.class.getName())
+            .setStringValue("date", Instant.now().toString());
         javaClass.addAnnotation(Configuration.class);
         javaClass.addAnnotation(ConditionalOnBean.class).setStringValue("type", "org.apache.camel.spring.boot.CamelAutoConfiguration");
         javaClass.addAnnotation(Conditional.class).setLiteralValue(name + ".Condition.class");
@@ -1246,6 +1265,8 @@ public class SpringBootAutoConfigurationMojo extends AbstractMojo {
         String doc = "Generated by camel-package-maven-plugin - do not edit this file!";
         javaClass.getJavaDoc().setFullText(doc);
 
+        javaClass.addAnnotation(Generated.class).setStringValue("value", SpringBootAutoConfigurationMojo.class.getName())
+        .setStringValue("date", Instant.now().toString());
         javaClass.addAnnotation(Configuration.class);
         javaClass.addAnnotation(ConditionalOnBean.class).setStringValue("type", "org.apache.camel.spring.boot.CamelAutoConfiguration");
         javaClass.addAnnotation(Conditional.class).setLiteralValue(name + ".Condition.class");
@@ -1322,6 +1343,8 @@ public class SpringBootAutoConfigurationMojo extends AbstractMojo {
         String doc = "Generated by camel-package-maven-plugin - do not edit this file!";
         javaClass.getJavaDoc().setFullText(doc);
 
+        javaClass.addAnnotation(Generated.class).setStringValue("value", SpringBootAutoConfigurationMojo.class.getName())
+        .setStringValue("date", Instant.now().toString());
         javaClass.addAnnotation(Configuration.class);
         javaClass.addAnnotation(ConditionalOnBean.class).setStringValue("type", "org.apache.camel.spring.boot.CamelAutoConfiguration");
         javaClass.addAnnotation(Conditional.class).setLiteralValue(name + ".Condition.class");
@@ -2023,6 +2046,9 @@ public class SpringBootAutoConfigurationMojo extends AbstractMojo {
         condition.extendSuperType(SpringBootCondition.class);
         condition.setPublic();
         condition.setStatic(true);
+        
+        condition.addAnnotation(Generated.class).setStringValue("value", SpringBootAutoConfigurationMojo.class.getName())
+        .setStringValue("date", Instant.now().toString());
 
         String fullQualifiedType = prefix.endsWith(".") ? prefix +  type : prefix + "." + type;
 

Loading...