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 2020/02/29 14:04:24 UTC

[camel-spring-boot] 01/02: CAMEL-14568: Remove unused stuff in tooling

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-spring-boot.git

commit 82d8b9cd06f06893aad2990c67637a9e7f5f40bd
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sat Feb 29 14:53:53 2020 +0100

    CAMEL-14568: Remove unused stuff in tooling
---
 .../maven/SpringBootAutoConfigurationMojo.java     | 41 ----------------------
 1 file changed, 41 deletions(-)

diff --git a/tooling/camel-spring-boot-generator-maven-plugin/src/main/java/org/apache/camel/springboot/maven/SpringBootAutoConfigurationMojo.java b/tooling/camel-spring-boot-generator-maven-plugin/src/main/java/org/apache/camel/springboot/maven/SpringBootAutoConfigurationMojo.java
index 2fd5b26..926282b 100644
--- a/tooling/camel-spring-boot-generator-maven-plugin/src/main/java/org/apache/camel/springboot/maven/SpringBootAutoConfigurationMojo.java
+++ b/tooling/camel-spring-boot-generator-maven-plugin/src/main/java/org/apache/camel/springboot/maven/SpringBootAutoConfigurationMojo.java
@@ -102,8 +102,6 @@ import org.springframework.context.annotation.Scope;
         defaultPhase = LifecyclePhase.GENERATE_RESOURCES)
 public class SpringBootAutoConfigurationMojo extends AbstractSpringBootGenerator {
 
-    protected static final String[] IGNORE_MODULES = {/* Non-standard -> */ "camel-grape"};
-
     /**
      * Useful to move configuration towards starters. Warning: the
      * spring.factories files sometimes are used also on the main artifacts.
@@ -123,14 +121,6 @@ public class SpringBootAutoConfigurationMojo extends AbstractSpringBootGenerator
      */
     private static final Pattern INCLUDE_INNER_PATTERN = Pattern.compile("org\\.apache\\.camel\\..*");
 
-    /**
-     * Whether to enable adding @NestedConfigurationProperty annotations to
-     * options. This is disabled as the generated options likely is not
-     * configurable as plain POJOs and there is also no documentation for each
-     * of the generated options.
-     */
-    private static final boolean ADD_NESTED_CONFIGURATION_PROPERTY = false;
-
     private static final Map<String, String> PRIMITIVEMAP;
     private static final Map<Type, Type> PRIMITIVE_CLASSES;
 
@@ -192,11 +182,6 @@ public class SpringBootAutoConfigurationMojo extends AbstractSpringBootGenerator
         }
     }
 
-    @Override
-    protected boolean isIgnore(String artifactId) {
-        return Arrays.asList(IGNORE_MODULES).contains(artifactId);
-    }
-
     private void executeModels(JarFile componentJar, Map<String, Supplier<String>> files) throws MojoExecutionException, MojoFailureException {
         String json;
 
@@ -733,14 +718,6 @@ public class SpringBootAutoConfigurationMojo extends AbstractSpringBootGenerator
             }
 
             Property prop = javaClass.addProperty(type, option.getName());
-            if (ADD_NESTED_CONFIGURATION_PROPERTY) {
-                if (!type.endsWith(INNER_TYPE_SUFFIX) && type.indexOf('[') == -1 && INCLUDE_INNER_PATTERN.matcher(type).matches() && isBlank(option.getEnums())
-                    && (javaClassSource == null || (javaClassSource.isClass() && !javaClassSource.isAbstract()))) {
-                    // add nested configuration annotation for complex
-                    // properties
-                    prop.getField().addAnnotation(NestedConfigurationProperty.class);
-                }
-            }
             if (option.isDeprecated()) {
                 prop.getField().addAnnotation(Deprecated.class);
                 prop.getAccessor().addAnnotation(Deprecated.class);
@@ -845,13 +822,6 @@ public class SpringBootAutoConfigurationMojo extends AbstractSpringBootGenerator
                     anEnum = false;
                 }
 
-                // add nested configuration annotation for complex properties
-                if (ADD_NESTED_CONFIGURATION_PROPERTY) {
-                    if (INCLUDE_INNER_PATTERN.matcher(propType.toString()).matches() && !propType.getRawClass().isArray() && !anEnum && optionClass != null
-                        && !optionClass.isInterface() && !optionClass.isAnnotation() && !Modifier.isAbstract(optionClass.getModifiers())) {
-                        prop.getField().addAnnotation(NestedConfigurationProperty.class);
-                    }
-                }
                 if (sourceProp.hasAnnotation(Deprecated.class)) {
                     if (deprecationNote != null && !deprecationNote.isEmpty()) {
                         String jd = prop.getField().getJavaDoc().getText();
@@ -1121,17 +1091,6 @@ public class SpringBootAutoConfigurationMojo extends AbstractSpringBootGenerator
     // read java type from project, returns null if not found
     private JavaClass readJavaType(String type) {
         if (!type.startsWith("java.lang.") && (!type.contains("<") || !type.contains(">"))) {
-//            final String fileName = type.replaceAll("[\\[\\]]", "").replaceAll("\\.", "\\/") + ".java";
-//            Path sourcePath = project.getCompileSourceRoots().stream().map(Paths::get).map(p -> p.resolve(fileName)).filter(Files::isRegularFile).findFirst().orElse(null);
-//            if (sourcePath == null) {
-//                return null;
-//            }
-//            String sourceCode;
-//            try (InputStream is = Files.newInputStream(sourcePath)) {
-//                sourceCode = loadText(is);
-//            } catch (IOException e) {
-//                throw new RuntimeException("Unable to load source code", e);
-//            }
             String sourceCode = "";
             try {
                 Class<?> clazz = getProjectClassLoader().loadClass(type);