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

apupier pushed a commit to branch revert-21390-pbs
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 8afcd509bc3aa91a3b429c5ca34d47e400ced6bf
Author: Aurélien Pupier <[email protected]>
AuthorDate: Wed Feb 11 11:02:26 2026 +0100

    Revert "CAMEL-22978: camel-core - Property binding 
constructor/factory-method…"
    
    This reverts commit 6979c761eea569d460de3f98bb0f438cb4d9ec72.
---
 ...ndingSupportClassConstructorOverloadedTest.java | 133 --------------------
 ...ingSupportClassFactoryMethodOverloadedTest.java | 137 ---------------------
 .../camel/support/PropertyBindingSupport.java      |  20 +--
 3 files changed, 6 insertions(+), 284 deletions(-)

diff --git 
a/core/camel-main/src/test/java/org/apache/camel/main/PropertyBindingSupportClassConstructorOverloadedTest.java
 
b/core/camel-main/src/test/java/org/apache/camel/main/PropertyBindingSupportClassConstructorOverloadedTest.java
deleted file mode 100644
index 94a49c34a751..000000000000
--- 
a/core/camel-main/src/test/java/org/apache/camel/main/PropertyBindingSupportClassConstructorOverloadedTest.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.main;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.impl.DefaultCamelContext;
-import org.apache.camel.support.PropertyBindingSupport;
-import org.junit.jupiter.api.Test;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertFalse;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-/**
- * Unit test for PropertyBindingSupport
- */
-public class PropertyBindingSupportClassConstructorOverloadedTest {
-
-    @Test
-    public void testConstructorOverloaded() {
-        CamelContext context = new DefaultCamelContext();
-
-        context.start();
-
-        MyApp target = new MyApp();
-
-        PropertyBindingSupport.build()
-                .withCamelContext(context)
-                .withTarget(target)
-                .withProperty("name", "Donald")
-                .withProperty("myBinding",
-                        "#class:" + MyBinding.class.getName() + 
"(true,'scott')")
-                .withRemoveParameters(false).bind();
-
-        assertEquals("Donald", target.getName());
-        assertTrue(target.getMyBinding().isFlag());
-        assertFalse(target.getMyBinding().isFlag2());
-        assertEquals("scott", target.getMyBinding().getUser());
-
-        context.stop();
-    }
-
-    @Test
-    public void testConstructorOverloadedTwo() {
-        CamelContext context = new DefaultCamelContext();
-
-        context.start();
-
-        MyApp target = new MyApp();
-
-        PropertyBindingSupport.build()
-                .withCamelContext(context)
-                .withTarget(target)
-                .withProperty("name", "Donald")
-                .withProperty("myBinding",
-                        "#class:" + MyBinding.class.getName() + "(true,true)")
-                .withRemoveParameters(false).bind();
-
-        assertEquals("Donald", target.getName());
-        assertTrue(target.getMyBinding().isFlag());
-        assertTrue(target.getMyBinding().isFlag2());
-        assertEquals("anonymous", target.getMyBinding().getUser());
-
-        context.stop();
-    }
-
-    public static class MyApp {
-
-        private String name;
-        private MyBinding myBinding;
-
-        public String getName() {
-            return name;
-        }
-
-        public void setName(String name) {
-            this.name = name;
-        }
-
-        public MyBinding getMyBinding() {
-            return myBinding;
-        }
-
-        public void setMyBinding(MyBinding myBinding) {
-            this.myBinding = myBinding;
-        }
-    }
-
-    public static class MyBinding {
-
-        private boolean flag;
-        private boolean flag2;
-        private String user;
-
-        public MyBinding(boolean flag, boolean flag2) {
-            this.flag = flag;
-            this.flag2 = flag2;
-            this.user = "anonymous";
-        }
-
-        public MyBinding(boolean flag, String user) {
-            this.flag = flag;
-            this.user = user;
-        }
-
-        public boolean isFlag() {
-            return flag;
-        }
-
-        public boolean isFlag2() {
-            return flag2;
-        }
-
-        public String getUser() {
-            return user;
-        }
-    }
-
-}
diff --git 
a/core/camel-main/src/test/java/org/apache/camel/main/PropertyBindingSupportClassFactoryMethodOverloadedTest.java
 
b/core/camel-main/src/test/java/org/apache/camel/main/PropertyBindingSupportClassFactoryMethodOverloadedTest.java
deleted file mode 100644
index d824d9a3b0b0..000000000000
--- 
a/core/camel-main/src/test/java/org/apache/camel/main/PropertyBindingSupportClassFactoryMethodOverloadedTest.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.main;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.impl.DefaultCamelContext;
-import org.apache.camel.support.PropertyBindingSupport;
-import org.junit.jupiter.api.Test;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertFalse;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-/**
- * Unit test for PropertyBindingSupport
- */
-public class PropertyBindingSupportClassFactoryMethodOverloadedTest {
-
-    @Test
-    public void testFactoryPropertyOverloaded() {
-        CamelContext context = new DefaultCamelContext();
-
-        context.start();
-
-        MyApp target = new MyApp();
-
-        PropertyBindingSupport.build()
-                .withCamelContext(context)
-                .withTarget(target)
-                .withProperty("name", "Donald")
-                .withProperty("myBinding",
-                        "#class:" + MyBinding.class.getName() + 
"#createBinding(true,'scott')")
-                .withRemoveParameters(false).bind();
-
-        assertEquals("Donald", target.getName());
-        assertTrue(target.getMyBinding().isFlag());
-        assertFalse(target.getMyBinding().isFlag2());
-        assertEquals("scott", target.getMyBinding().getUser());
-
-        context.stop();
-    }
-
-    @Test
-    public void testFactoryPropertyOverloadedTwo() {
-        CamelContext context = new DefaultCamelContext();
-
-        context.start();
-
-        MyApp target = new MyApp();
-
-        PropertyBindingSupport.build()
-                .withCamelContext(context)
-                .withTarget(target)
-                .withProperty("name", "Donald")
-                .withProperty("myBinding",
-                        "#class:" + MyBinding.class.getName() + 
"#createBinding(true,true)")
-                .withRemoveParameters(false).bind();
-
-        assertEquals("Donald", target.getName());
-        assertTrue(target.getMyBinding().isFlag());
-        assertTrue(target.getMyBinding().isFlag2());
-        assertEquals("anonymous", target.getMyBinding().getUser());
-
-        context.stop();
-    }
-
-    public static class MyApp {
-
-        private String name;
-        private MyBinding myBinding;
-
-        public String getName() {
-            return name;
-        }
-
-        public void setName(String name) {
-            this.name = name;
-        }
-
-        public MyBinding getMyBinding() {
-            return myBinding;
-        }
-
-        public void setMyBinding(MyBinding myBinding) {
-            this.myBinding = myBinding;
-        }
-    }
-
-    public static class MyBinding {
-
-        private boolean flag;
-        private boolean flag2;
-        private String user;
-
-        public static MyBinding createBinding(boolean flag, String user) {
-            MyBinding binding = new MyBinding();
-            binding.flag = flag;
-            binding.user = user;
-            return binding;
-        }
-
-        public static MyBinding createBinding(boolean flag, boolean flag2) {
-            MyBinding binding = new MyBinding();
-            binding.flag = flag;
-            binding.flag2 = flag2;
-            binding.user = "anonymous";
-            return binding;
-        }
-
-        public boolean isFlag() {
-            return flag;
-        }
-
-        public boolean isFlag2() {
-            return flag2;
-        }
-
-        public String getUser() {
-            return user;
-        }
-    }
-
-}
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 3d8df6cced76..bef39e9a43f6 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
@@ -1251,8 +1251,7 @@ public final class PropertyBindingSupport {
      */
     public static Object newInstanceConstructorParameters(CamelContext 
camelContext, Class<?> type, String parameters)
             throws Exception {
-        // keep quotes as we need to understand the parameter type if its 
boolean,numbers or string (quoted)
-        String[] params = StringQuoteHelper.splitSafeQuote(parameters, ',', 
true, true);
+        String[] params = StringQuoteHelper.splitSafeQuote(parameters, ',');
         Constructor<?> found = findMatchingConstructor(camelContext, 
type.getConstructors(), params);
         if (found != null) {
             Object[] arr = new Object[found.getParameterCount()];
@@ -1262,14 +1261,11 @@ public final class PropertyBindingSupport {
                 Object val = null;
                 // special as we may refer to other #bean or #type in the 
parameter
                 if (param instanceof String str) {
-                    String ref = 
StringHelper.removeLeadingAndEndingQuotes(str);
-                    if (ref.startsWith("#")) {
-                        Object bean = resolveBean(camelContext, ref);
+                    if (str.startsWith("#")) {
+                        Object bean = resolveBean(camelContext, param);
                         if (bean != null) {
                             val = bean;
                         }
-                    } else {
-                        val = str;
                     }
                 }
                 // unquote text
@@ -1355,8 +1351,7 @@ public final class PropertyBindingSupport {
     public static Object newInstanceFactoryParameters(
             CamelContext camelContext, Class<?> type, String factoryMethod, 
String parameters)
             throws Exception {
-        // keep quotes as we need to understand the parameter type if its 
boolean,numbers or string (quoted)
-        String[] params = StringQuoteHelper.splitSafeQuote(parameters, ',', 
true, true);
+        String[] params = StringQuoteHelper.splitSafeQuote(parameters, ',');
         Method found = findMatchingFactoryMethod(camelContext, 
type.getMethods(), factoryMethod, params);
         if (found != null) {
             Object[] arr = new Object[found.getParameterCount()];
@@ -1366,14 +1361,11 @@ public final class PropertyBindingSupport {
                 Object val = null;
                 // special as we may refer to other #bean or #type in the 
parameter
                 if (param instanceof String str) {
-                    String ref = 
StringHelper.removeLeadingAndEndingQuotes(str);
-                    if (ref.startsWith("#")) {
-                        Object bean = resolveBean(camelContext, ref);
+                    if (str.startsWith("#")) {
+                        Object bean = resolveBean(camelContext, param);
                         if (bean != null) {
                             val = bean;
                         }
-                    } else {
-                        val = str;
                     }
                 }
                 // unquote text

Reply via email to