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

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


The following commit(s) were added to refs/heads/main by this push:
     new ee5416f94eb camel-core - Avoid properties component to use reflection
ee5416f94eb is described below

commit ee5416f94ebece00814f6a71570224b5c6c9f674
Author: Claus Ibsen <[email protected]>
AuthorDate: Mon Sep 12 16:47:03 2022 +0200

    camel-core - Avoid properties component to use reflection
---
 .../properties/PropertiesComponentConfigurer.java  | 136 +++++++++++++++++++++
 ....camel.component.properties.PropertiesComponent |   2 +
 .../component/properties/PropertiesComponent.java  |  17 +--
 3 files changed, 140 insertions(+), 15 deletions(-)

diff --git 
a/core/camel-base/src/generated/java/org/apache/camel/component/properties/PropertiesComponentConfigurer.java
 
b/core/camel-base/src/generated/java/org/apache/camel/component/properties/PropertiesComponentConfigurer.java
new file mode 100644
index 00000000000..9da5505251a
--- /dev/null
+++ 
b/core/camel-base/src/generated/java/org/apache/camel/component/properties/PropertiesComponentConfigurer.java
@@ -0,0 +1,136 @@
+/* Generated by camel build tools - do NOT edit this file! */
+package org.apache.camel.component.properties;
+
+import java.util.Map;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.spi.ExtendedPropertyConfigurerGetter;
+import org.apache.camel.spi.PropertyConfigurerGetter;
+import org.apache.camel.spi.ConfigurerStrategy;
+import org.apache.camel.spi.GeneratedPropertyConfigurer;
+import org.apache.camel.util.CaseInsensitiveMap;
+import org.apache.camel.component.properties.PropertiesComponent;
+
+/**
+ * Generated by camel build tools - do NOT edit this file!
+ */
+@SuppressWarnings("unchecked")
+public class PropertiesComponentConfigurer extends 
org.apache.camel.support.component.PropertyConfigurerSupport implements 
GeneratedPropertyConfigurer, PropertyConfigurerGetter {
+
+    @Override
+    public boolean configure(CamelContext camelContext, Object obj, String 
name, Object value, boolean ignoreCase) {
+        org.apache.camel.component.properties.PropertiesComponent target = 
(org.apache.camel.component.properties.PropertiesComponent) obj;
+        switch (ignoreCase ? name.toLowerCase() : name) {
+        case "autodiscoverpropertiessources":
+        case "AutoDiscoverPropertiesSources": 
target.setAutoDiscoverPropertiesSources(property(camelContext, boolean.class, 
value)); return true;
+        case "camelcontext":
+        case "CamelContext": target.setCamelContext(property(camelContext, 
org.apache.camel.CamelContext.class, value)); return true;
+        case "defaultfallbackenabled":
+        case "DefaultFallbackEnabled": 
target.setDefaultFallbackEnabled(property(camelContext, boolean.class, value)); 
return true;
+        case "encoding":
+        case "Encoding": target.setEncoding(property(camelContext, 
java.lang.String.class, value)); return true;
+        case "environmentvariablemode":
+        case "EnvironmentVariableMode": 
target.setEnvironmentVariableMode(property(camelContext, int.class, value)); 
return true;
+        case "ignoremissinglocation":
+        case "IgnoreMissingLocation": 
target.setIgnoreMissingLocation(property(camelContext, boolean.class, value)); 
return true;
+        case "initialproperties":
+        case "InitialProperties": 
target.setInitialProperties(property(camelContext, java.util.Properties.class, 
value)); return true;
+        case "localproperties":
+        case "LocalProperties": 
target.setLocalProperties(property(camelContext, java.util.Properties.class, 
value)); return true;
+        case "location":
+        case "Location": target.setLocation(property(camelContext, 
java.lang.String.class, value)); return true;
+        case "locations":
+        case "Locations": target.setLocations(property(camelContext, 
java.util.List.class, value)); return true;
+        case "overrideproperties":
+        case "OverrideProperties": 
target.setOverrideProperties(property(camelContext, java.util.Properties.class, 
value)); return true;
+        case "propertiesfunctionresolver":
+        case "PropertiesFunctionResolver": 
target.setPropertiesFunctionResolver(property(camelContext, 
org.apache.camel.component.properties.PropertiesFunctionResolver.class, 
value)); return true;
+        case "propertiesparser":
+        case "PropertiesParser": 
target.setPropertiesParser(property(camelContext, 
org.apache.camel.component.properties.PropertiesParser.class, value)); return 
true;
+        case "systempropertiesmode":
+        case "SystemPropertiesMode": 
target.setSystemPropertiesMode(property(camelContext, int.class, value)); 
return true;
+        default: return false;
+        }
+    }
+
+    @Override
+    public Class<?> getOptionType(String name, boolean ignoreCase) {
+        switch (ignoreCase ? name.toLowerCase() : name) {
+        case "autodiscoverpropertiessources":
+        case "AutoDiscoverPropertiesSources": return boolean.class;
+        case "camelcontext":
+        case "CamelContext": return org.apache.camel.CamelContext.class;
+        case "defaultfallbackenabled":
+        case "DefaultFallbackEnabled": return boolean.class;
+        case "encoding":
+        case "Encoding": return java.lang.String.class;
+        case "environmentvariablemode":
+        case "EnvironmentVariableMode": return int.class;
+        case "ignoremissinglocation":
+        case "IgnoreMissingLocation": return boolean.class;
+        case "initialproperties":
+        case "InitialProperties": return java.util.Properties.class;
+        case "localproperties":
+        case "LocalProperties": return java.util.Properties.class;
+        case "location":
+        case "Location": return java.lang.String.class;
+        case "locations":
+        case "Locations": return java.util.List.class;
+        case "overrideproperties":
+        case "OverrideProperties": return java.util.Properties.class;
+        case "propertiesfunctionresolver":
+        case "PropertiesFunctionResolver": return 
org.apache.camel.component.properties.PropertiesFunctionResolver.class;
+        case "propertiesparser":
+        case "PropertiesParser": return 
org.apache.camel.component.properties.PropertiesParser.class;
+        case "systempropertiesmode":
+        case "SystemPropertiesMode": return int.class;
+        default: return null;
+        }
+    }
+
+    @Override
+    public Object getOptionValue(Object obj, String name, boolean ignoreCase) {
+        org.apache.camel.component.properties.PropertiesComponent target = 
(org.apache.camel.component.properties.PropertiesComponent) obj;
+        switch (ignoreCase ? name.toLowerCase() : name) {
+        case "autodiscoverpropertiessources":
+        case "AutoDiscoverPropertiesSources": return 
target.isAutoDiscoverPropertiesSources();
+        case "camelcontext":
+        case "CamelContext": return target.getCamelContext();
+        case "defaultfallbackenabled":
+        case "DefaultFallbackEnabled": return 
target.isDefaultFallbackEnabled();
+        case "encoding":
+        case "Encoding": return target.getEncoding();
+        case "environmentvariablemode":
+        case "EnvironmentVariableMode": return 
target.getEnvironmentVariableMode();
+        case "ignoremissinglocation":
+        case "IgnoreMissingLocation": return target.isIgnoreMissingLocation();
+        case "initialproperties":
+        case "InitialProperties": return target.getInitialProperties();
+        case "localproperties":
+        case "LocalProperties": return target.getLocalProperties();
+        case "location":
+        case "Location": return target.getLocation();
+        case "locations":
+        case "Locations": return target.getLocations();
+        case "overrideproperties":
+        case "OverrideProperties": return target.getOverrideProperties();
+        case "propertiesfunctionresolver":
+        case "PropertiesFunctionResolver": return 
target.getPropertiesFunctionResolver();
+        case "propertiesparser":
+        case "PropertiesParser": return target.getPropertiesParser();
+        case "systempropertiesmode":
+        case "SystemPropertiesMode": return target.getSystemPropertiesMode();
+        default: return null;
+        }
+    }
+
+    @Override
+    public Object getCollectionValueType(Object target, String name, boolean 
ignoreCase) {
+        switch (ignoreCase ? name.toLowerCase() : name) {
+        case "locations":
+        case "Locations": return 
org.apache.camel.component.properties.PropertiesLocation.class;
+        default: return null;
+        }
+    }
+}
+
diff --git 
a/core/camel-base/src/generated/resources/META-INF/services/org/apache/camel/configurer/org.apache.camel.component.properties.PropertiesComponent
 
b/core/camel-base/src/generated/resources/META-INF/services/org/apache/camel/configurer/org.apache.camel.component.properties.PropertiesComponent
new file mode 100644
index 00000000000..dd9eeb66b4e
--- /dev/null
+++ 
b/core/camel-base/src/generated/resources/META-INF/services/org/apache/camel/configurer/org.apache.camel.component.properties.PropertiesComponent
@@ -0,0 +1,2 @@
+# Generated by camel build tools - do NOT edit this file!
+class=org.apache.camel.component.properties.PropertiesComponentConfigurer
diff --git 
a/core/camel-base/src/main/java/org/apache/camel/component/properties/PropertiesComponent.java
 
b/core/camel-base/src/main/java/org/apache/camel/component/properties/PropertiesComponent.java
index 70208551b99..94d30715e73 100644
--- 
a/core/camel-base/src/main/java/org/apache/camel/component/properties/PropertiesComponent.java
+++ 
b/core/camel-base/src/main/java/org/apache/camel/component/properties/PropertiesComponent.java
@@ -35,6 +35,7 @@ import org.apache.camel.StaticService;
 import org.apache.camel.api.management.ManagedAttribute;
 import org.apache.camel.api.management.ManagedOperation;
 import org.apache.camel.api.management.ManagedResource;
+import org.apache.camel.spi.Configurer;
 import org.apache.camel.spi.FactoryFinder;
 import org.apache.camel.spi.LoadablePropertiesSource;
 import org.apache.camel.spi.PropertiesFunction;
@@ -56,6 +57,7 @@ import org.slf4j.LoggerFactory;
  */
 @ManagedResource(description = "Managed PropertiesComponent")
 @JdkService(org.apache.camel.spi.PropertiesComponent.FACTORY)
+@Configurer(bootstrap = true)
 public class PropertiesComponent extends ServiceSupport
         implements org.apache.camel.spi.PropertiesComponent, StaticService, 
CamelContextAware {
 
@@ -362,21 +364,6 @@ public class PropertiesComponent extends ServiceSupport
         setLocations(locations);
     }
 
-    /**
-     * A list of locations to load properties. This option will override any 
default locations and only use the
-     * locations from this option.
-     */
-    public void setLocations(Collection<String> locationStrings) {
-        List<PropertiesLocation> locations = new ArrayList<>();
-        if (locationStrings != null) {
-            for (String locationString : locationStrings) {
-                locations.add(new PropertiesLocation(locationString));
-            }
-        }
-
-        setLocations(locations);
-    }
-
     public void addLocation(PropertiesLocation location) {
         this.locations.add(location);
     }

Reply via email to