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.git


The following commit(s) were added to refs/heads/master by this push:
     new 4ddb1bd  BeanIntrospection - Reduce number of methods.
4ddb1bd is described below

commit 4ddb1bdcbb364bb92afc2e134afad00e94c135bb
Author: Claus Ibsen <claus.ib...@gmail.com>
AuthorDate: Sun Aug 25 18:20:01 2019 +0200

    BeanIntrospection - Reduce number of methods.
---
 .../main/java/org/apache/camel/spi/BeanIntrospection.java   | 13 ++++---------
 .../apache/camel/impl/engine/DefaultBeanIntrospection.java  | 13 -------------
 .../apache/camel/reifier/dataformat/DataFormatReifier.java  |  2 +-
 .../main/java/org/apache/camel/support/EndpointHelper.java  |  2 +-
 .../org/apache/camel/support/PropertyBindingSupport.java    |  4 +---
 5 files changed, 7 insertions(+), 27 deletions(-)

diff --git 
a/core/camel-api/src/main/java/org/apache/camel/spi/BeanIntrospection.java 
b/core/camel-api/src/main/java/org/apache/camel/spi/BeanIntrospection.java
index 8077efa..99aaf2d 100644
--- a/core/camel-api/src/main/java/org/apache/camel/spi/BeanIntrospection.java
+++ b/core/camel-api/src/main/java/org/apache/camel/spi/BeanIntrospection.java
@@ -26,16 +26,11 @@ import org.apache.camel.StaticService;
 import org.apache.camel.TypeConverter;
 import org.apache.camel.meta.Experimental;
 
-// TODO: Add javadoc for methods
-// TODO: Consolidate some of the methods
-
 /**
  * Used for introspecting beans properties via Java reflection; such as 
extracting current property values,
  * or updating one or more properties etc.
  *
  * End users should favour using 
org.apache.camel.support.PropertyBindingSupport instead.
- * <p/>
- * Notice this API is not final yet
  */
 @Experimental
 public interface BeanIntrospection extends StaticService {
@@ -173,8 +168,7 @@ public interface BeanIntrospection extends StaticService {
      * found matching the property name on the {@code target} bean. For this 
mode to be triggered the parameters
      * {@code context} and {@code refName} must NOT be NULL, and {@code value} 
MUST be NULL.
      */
-    boolean setProperty(CamelContext context, TypeConverter typeConverter, 
Object target, String name, Object value, String refName,
-                                      boolean allowBuilderPattern) throws 
Exception;
+    boolean setProperty(CamelContext context, Object target, String name, 
Object value) throws Exception;
 
     /**
      * This method supports three modes to set a property:
@@ -191,8 +185,9 @@ public interface BeanIntrospection extends StaticService {
     boolean setProperty(CamelContext context, TypeConverter typeConverter, 
Object target, String name, Object value, String refName,
                                       boolean allowBuilderPattern, boolean 
allowPrivateSetter, boolean ignoreCase) throws Exception;
 
-    boolean setProperty(CamelContext context, Object target, String name, 
Object value) throws Exception;
-
+    /**
+     * Find all the setter methods on the class
+     */
     Set<Method> findSetterMethods(Class<?> clazz, String name, boolean 
allowBuilderPattern, boolean allowPrivateSetter, boolean ignoreCase);
 
 }
diff --git 
a/core/camel-base/src/main/java/org/apache/camel/impl/engine/DefaultBeanIntrospection.java
 
b/core/camel-base/src/main/java/org/apache/camel/impl/engine/DefaultBeanIntrospection.java
index a6c097e..7846b93 100644
--- 
a/core/camel-base/src/main/java/org/apache/camel/impl/engine/DefaultBeanIntrospection.java
+++ 
b/core/camel-base/src/main/java/org/apache/camel/impl/engine/DefaultBeanIntrospection.java
@@ -145,19 +145,6 @@ public class DefaultBeanIntrospection extends 
ServiceSupport implements BeanIntr
     }
 
     @Override
-    public boolean setProperty(CamelContext context, TypeConverter 
typeConverter, Object target, String name, Object value, String refName, 
boolean allowBuilderPattern) throws Exception {
-        invoked.incrementAndGet();
-        if (logger.shouldLog()) {
-            Object text = value;
-            if (SECRETS.matcher(name).find()) {
-                text = "xxxxxx";
-            }
-            log("setProperty", target, name, text);
-        }
-        return IntrospectionSupport.setProperty(context, typeConverter, 
target, name, value, refName, allowBuilderPattern);
-    }
-
-    @Override
     public boolean setProperty(CamelContext context, TypeConverter 
typeConverter, Object target, String name, Object value, String refName, 
boolean allowBuilderPattern, boolean allowPrivateSetter, boolean ignoreCase) 
throws Exception {
         invoked.incrementAndGet();
         if (logger.shouldLog()) {
diff --git 
a/core/camel-core/src/main/java/org/apache/camel/reifier/dataformat/DataFormatReifier.java
 
b/core/camel-core/src/main/java/org/apache/camel/reifier/dataformat/DataFormatReifier.java
index 9ccc7ad..2098107 100644
--- 
a/core/camel-core/src/main/java/org/apache/camel/reifier/dataformat/DataFormatReifier.java
+++ 
b/core/camel-core/src/main/java/org/apache/camel/reifier/dataformat/DataFormatReifier.java
@@ -238,7 +238,7 @@ public abstract class DataFormatReifier<T extends 
DataFormatDefinition> {
         try {
             String ref = value instanceof String ? value.toString() : null;
             if (isReferenceParameter(ref) && camelContext != null) {
-                
camelContext.adapt(ExtendedCamelContext.class).getBeanIntrospection().setProperty(camelContext,
 camelContext.getTypeConverter(), bean, name, null, ref, true);
+                
camelContext.adapt(ExtendedCamelContext.class).getBeanIntrospection().setProperty(camelContext,
 camelContext.getTypeConverter(), bean, name, null, ref, true, false, false);
             } else {
                 
camelContext.adapt(ExtendedCamelContext.class).getBeanIntrospection().setProperty(camelContext,
 bean, name, value);
             }
diff --git 
a/core/camel-support/src/main/java/org/apache/camel/support/EndpointHelper.java 
b/core/camel-support/src/main/java/org/apache/camel/support/EndpointHelper.java
index 393fd82..c8b2d69 100644
--- 
a/core/camel-support/src/main/java/org/apache/camel/support/EndpointHelper.java
+++ 
b/core/camel-support/src/main/java/org/apache/camel/support/EndpointHelper.java
@@ -182,7 +182,7 @@ public final class EndpointHelper {
             Object v = entry.getValue();
             String value = v != null ? v.toString() : null;
             if (isReferenceParameter(value)) {
-                boolean hit = 
context.adapt(ExtendedCamelContext.class).getBeanIntrospection().setProperty(context,
 context.getTypeConverter(), bean, name, null, value, true);
+                boolean hit = 
context.adapt(ExtendedCamelContext.class).getBeanIntrospection().setProperty(context,
 context.getTypeConverter(), bean, name, null, value, true, false, false);
                 if (hit) {
                     // must remove as its a valid option and we could 
configure it
                     it.remove();
diff --git 
a/core/camel-support/src/main/java/org/apache/camel/support/PropertyBindingSupport.java
 
b/core/camel-support/src/main/java/org/apache/camel/support/PropertyBindingSupport.java
index 0d70e88..b619a7c 100644
--- 
a/core/camel-support/src/main/java/org/apache/camel/support/PropertyBindingSupport.java
+++ 
b/core/camel-support/src/main/java/org/apache/camel/support/PropertyBindingSupport.java
@@ -644,8 +644,6 @@ public final class PropertyBindingSupport {
             }
         }
 
-        // TODO: Move configurer here so the value can have done all its magic
-
         boolean hit = 
context.adapt(ExtendedCamelContext.class).getBeanIntrospection().setProperty(context,
 context.getTypeConverter(), target, name, value, refName, fluentBuilder, 
allowPrivateSetter, ignoreCase);
         if (!hit && mandatory) {
             // there is no setter with this given name, so lets report this as 
a problem
@@ -744,7 +742,7 @@ public final class PropertyBindingSupport {
             String value = v != null ? v.toString() : null;
             if (isReferenceParameter(value)) {
                 try {
-                    boolean hit = 
context.adapt(ExtendedCamelContext.class).getBeanIntrospection().setProperty(context,
 context.getTypeConverter(), target, name, null, value, true);
+                    boolean hit = 
context.adapt(ExtendedCamelContext.class).getBeanIntrospection().setProperty(context,
 context.getTypeConverter(), target, name, null, value, true, false, false);
                     if (hit) {
                         // must remove as its a valid option and we could 
configure it
                         it.remove();

Reply via email to