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 2019/08/25 16:14:07 UTC

[camel] branch master updated: BeanIntrospection - Reduce number of methods.

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 4812fbd  BeanIntrospection - Reduce number of methods.
4812fbd is described below

commit 4812fbda47d94a412634f30b82bc2b7c2b8e5f10
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sun Aug 25 18:13:44 2019 +0200

    BeanIntrospection - Reduce number of methods.
---
 .../main/java/org/apache/camel/spi/BeanIntrospection.java  |  2 --
 .../apache/camel/impl/engine/DefaultBeanIntrospection.java | 13 -------------
 .../org/apache/camel/reifier/rest/RestBindingReifier.java  | 14 +++++++-------
 3 files changed, 7 insertions(+), 22 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 aad2886..8077efa 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
@@ -193,8 +193,6 @@ public interface BeanIntrospection extends StaticService {
 
     boolean setProperty(CamelContext context, Object target, String name, Object value) throws Exception;
 
-    boolean setProperty(TypeConverter typeConverter, Object target, String name, Object value) throws Exception;
-
     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 8a647f7..a6c097e 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
@@ -184,19 +184,6 @@ public class DefaultBeanIntrospection extends ServiceSupport implements BeanIntr
     }
 
     @Override
-    public boolean setProperty(TypeConverter typeConverter, Object target, String name, Object value) 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(typeConverter, target, name, value);
-    }
-
-    @Override
     public Set<Method> findSetterMethods(Class<?> clazz, String name, boolean allowBuilderPattern, boolean allowPrivateSetter, boolean ignoreCase) {
         invoked.incrementAndGet();
         if (logger.shouldLog()) {
diff --git a/core/camel-core/src/main/java/org/apache/camel/reifier/rest/RestBindingReifier.java b/core/camel-core/src/main/java/org/apache/camel/reifier/rest/RestBindingReifier.java
index 465aaa9..619cae8 100644
--- a/core/camel-core/src/main/java/org/apache/camel/reifier/rest/RestBindingReifier.java
+++ b/core/camel-core/src/main/java/org/apache/camel/reifier/rest/RestBindingReifier.java
@@ -97,8 +97,8 @@ public class RestBindingReifier {
                     clazz = context.getClassResolver().resolveMandatoryClass(typeName);
                 }
                 if (clazz != null) {
-                    context.adapt(ExtendedCamelContext.class).getBeanIntrospection().setProperty(context.getTypeConverter(), json, "unmarshalType", clazz);
-                    context.adapt(ExtendedCamelContext.class).getBeanIntrospection().setProperty(context.getTypeConverter(), json, "useList", type.endsWith("[]"));
+                    context.adapt(ExtendedCamelContext.class).getBeanIntrospection().setProperty(context, json, "unmarshalType", clazz);
+                    context.adapt(ExtendedCamelContext.class).getBeanIntrospection().setProperty(context, json, "useList", type.endsWith("[]"));
                 }
                 setAdditionalConfiguration(config, context, json, "json.in.");
 
@@ -109,8 +109,8 @@ public class RestBindingReifier {
                     outClazz = context.getClassResolver().resolveMandatoryClass(typeName);
                 }
                 if (outClazz != null) {
-                    context.adapt(ExtendedCamelContext.class).getBeanIntrospection().setProperty(context.getTypeConverter(), outJson, "unmarshalType", outClazz);
-                    context.adapt(ExtendedCamelContext.class).getBeanIntrospection().setProperty(context.getTypeConverter(), outJson, "useList", outType.endsWith("[]"));
+                    context.adapt(ExtendedCamelContext.class).getBeanIntrospection().setProperty(context, outJson, "unmarshalType", outClazz);
+                    context.adapt(ExtendedCamelContext.class).getBeanIntrospection().setProperty(context, outJson, "useList", outType.endsWith("[]"));
                 }
                 setAdditionalConfiguration(config, context, outJson, "json.out.");
             }
@@ -149,7 +149,7 @@ public class RestBindingReifier {
                 }
                 if (clazz != null) {
                     JAXBContext jc = JAXBContext.newInstance(clazz);
-                    context.adapt(ExtendedCamelContext.class).getBeanIntrospection().setProperty(context.getTypeConverter(), jaxb, "context", jc);
+                    context.adapt(ExtendedCamelContext.class).getBeanIntrospection().setProperty(context, jaxb, "context", jc);
                 }
                 setAdditionalConfiguration(config, context, jaxb, "xml.in.");
 
@@ -161,11 +161,11 @@ public class RestBindingReifier {
                 }
                 if (outClazz != null) {
                     JAXBContext jc = JAXBContext.newInstance(outClazz);
-                    context.adapt(ExtendedCamelContext.class).getBeanIntrospection().setProperty(context.getTypeConverter(), outJaxb, "context", jc);
+                    context.adapt(ExtendedCamelContext.class).getBeanIntrospection().setProperty(context, outJaxb, "context", jc);
                 } else if (clazz != null) {
                     // fallback and use the context from the input
                     JAXBContext jc = JAXBContext.newInstance(clazz);
-                    context.adapt(ExtendedCamelContext.class).getBeanIntrospection().setProperty(context.getTypeConverter(), outJaxb, "context", jc);
+                    context.adapt(ExtendedCamelContext.class).getBeanIntrospection().setProperty(context, outJaxb, "context", jc);
                 }
                 setAdditionalConfiguration(config, context, outJaxb, "xml.out.");
             }