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/09 13:24:49 UTC
[camel] 01/02: CAMEL-13846: Make PropertyBindingSupport a fluent
builder only
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
commit a429059dc66be64631d3702e57349ad286faeec9
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Aug 9 15:14:47 2019 +0200
CAMEL-13846: Make PropertyBindingSupport a fluent builder only
---
.../cloud/ServiceCallExpressionConfiguration.java | 2 +-
.../ServiceCallServiceChooserConfiguration.java | 2 +-
.../ServiceCallServiceDiscoveryConfiguration.java | 2 +-
.../ServiceCallServiceFilterConfiguration.java | 2 +-
...erviceCallServiceLoadBalancerConfiguration.java | 2 +-
.../camel/reifier/rest/RestBindingReifier.java | 2 +-
...opertyBindingSupportAutowireNestedDeepTest.java | 2 +-
.../PropertyBindingSupportAutowireNestedTest.java | 10 +-
.../PropertyBindingSupportAutowireTest.java | 2 +-
.../support/PropertyBindingSupportListTest.java | 8 +-
.../support/PropertyBindingSupportMapTest.java | 8 +-
.../camel/support/PropertyBindingSupportTest.java | 111 +++++----
.../java/org/apache/camel/main/MainSupport.java | 10 +-
.../management/JmxManagementStrategyFactory.java | 2 +-
.../DefaultComponentVerifierExtension.java | 2 +-
.../org/apache/camel/support/DefaultComponent.java | 2 +-
.../org/apache/camel/support/DefaultEndpoint.java | 2 +-
.../org/apache/camel/support/EndpointHelper.java | 2 +-
.../camel/support/PropertyBindingSupport.java | 257 +++++++++++----------
.../camel/support/RestProducerFactoryHelper.java | 6 +-
.../camel/support/ScheduledPollConsumer.java | 4 +-
.../support/component/AbstractApiComponent.java | 2 +-
22 files changed, 238 insertions(+), 204 deletions(-)
diff --git a/core/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallExpressionConfiguration.java b/core/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallExpressionConfiguration.java
index 61ef0d1..131766d 100644
--- a/core/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallExpressionConfiguration.java
+++ b/core/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallExpressionConfiguration.java
@@ -268,7 +268,7 @@ public class ServiceCallExpressionConfiguration extends IdentifiedType implement
postProcessFactoryParameters(camelContext, parameters);
- PropertyBindingSupport.bindProperties(camelContext, factory, parameters);
+ PropertyBindingSupport.build().bind(camelContext, factory, parameters);
answer = factory.newInstance(camelContext);
} catch (Exception e) {
diff --git a/core/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallServiceChooserConfiguration.java b/core/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallServiceChooserConfiguration.java
index 5b2c2d5..4366890 100644
--- a/core/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallServiceChooserConfiguration.java
+++ b/core/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallServiceChooserConfiguration.java
@@ -186,7 +186,7 @@ public class ServiceCallServiceChooserConfiguration extends IdentifiedType imple
postProcessFactoryParameters(camelContext, parameters);
- PropertyBindingSupport.bindProperties(camelContext, factory, parameters);
+ PropertyBindingSupport.build().bind(camelContext, factory, parameters);
answer = factory.newInstance(camelContext);
} catch (Exception e) {
diff --git a/core/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallServiceDiscoveryConfiguration.java b/core/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallServiceDiscoveryConfiguration.java
index 3203420..81524ac 100644
--- a/core/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallServiceDiscoveryConfiguration.java
+++ b/core/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallServiceDiscoveryConfiguration.java
@@ -193,7 +193,7 @@ public class ServiceCallServiceDiscoveryConfiguration extends IdentifiedType imp
postProcessFactoryParameters(camelContext, parameters);
- PropertyBindingSupport.bindProperties(camelContext, factory, parameters);
+ PropertyBindingSupport.build().bind(camelContext, factory, parameters);
answer = factory.newInstance(camelContext);
} catch (Exception e) {
diff --git a/core/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallServiceFilterConfiguration.java b/core/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallServiceFilterConfiguration.java
index cb14348..5a4c3dc 100644
--- a/core/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallServiceFilterConfiguration.java
+++ b/core/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallServiceFilterConfiguration.java
@@ -186,7 +186,7 @@ public class ServiceCallServiceFilterConfiguration extends IdentifiedType implem
postProcessFactoryParameters(camelContext, parameters);
- PropertyBindingSupport.bindProperties(camelContext, factory, parameters);
+ PropertyBindingSupport.build().bind(camelContext, factory, parameters);
answer = factory.newInstance(camelContext);
} catch (Exception e) {
diff --git a/core/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallServiceLoadBalancerConfiguration.java b/core/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallServiceLoadBalancerConfiguration.java
index d31fecbb..07f7c23 100644
--- a/core/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallServiceLoadBalancerConfiguration.java
+++ b/core/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallServiceLoadBalancerConfiguration.java
@@ -186,7 +186,7 @@ public class ServiceCallServiceLoadBalancerConfiguration extends IdentifiedType
postProcessFactoryParameters(camelContext, parameters);
- PropertyBindingSupport.bindProperties(camelContext, factory, parameters);
+ PropertyBindingSupport.build().bind(camelContext, factory, parameters);
answer = factory.newInstance(camelContext);
} catch (Exception e) {
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 04928f0..2110edf 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
@@ -199,7 +199,7 @@ public class RestBindingReifier {
}
}
- PropertyBindingSupport.bindProperties(context, dataFormat, copy);
+ PropertyBindingSupport.build().bind(context, dataFormat, copy);
}
}
diff --git a/core/camel-core/src/test/java/org/apache/camel/support/PropertyBindingSupportAutowireNestedDeepTest.java b/core/camel-core/src/test/java/org/apache/camel/support/PropertyBindingSupportAutowireNestedDeepTest.java
index 5c706fe..79a5233 100644
--- a/core/camel-core/src/test/java/org/apache/camel/support/PropertyBindingSupportAutowireNestedDeepTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/support/PropertyBindingSupportAutowireNestedDeepTest.java
@@ -41,7 +41,7 @@ public class PropertyBindingSupportAutowireNestedDeepTest extends ContextTestSup
public void testAutowirePropertiesDeep() throws Exception {
Foo foo = new Foo();
- PropertyBindingSupport.bindProperty(context, foo, "name", "James");
+ PropertyBindingSupport.build().bind(context, foo, "name", "James");
// use deep nesting
PropertyBindingSupport.autowireSingletonPropertiesFromRegistry(context, foo, false, true, null);
diff --git a/core/camel-core/src/test/java/org/apache/camel/support/PropertyBindingSupportAutowireNestedTest.java b/core/camel-core/src/test/java/org/apache/camel/support/PropertyBindingSupportAutowireNestedTest.java
index 84ab322..d958404 100644
--- a/core/camel-core/src/test/java/org/apache/camel/support/PropertyBindingSupportAutowireNestedTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/support/PropertyBindingSupportAutowireNestedTest.java
@@ -41,11 +41,11 @@ public class PropertyBindingSupportAutowireNestedTest extends ContextTestSupport
public void testAutowireProperties() throws Exception {
Foo foo = new Foo();
- PropertyBindingSupport.bindProperty(context, foo, "name", "James");
- PropertyBindingSupport.bindProperty(context, foo, "bar.age", "33");
- PropertyBindingSupport.bindProperty(context, foo, "bar.rider", "true");
- PropertyBindingSupport.bindProperty(context, foo, "bar.gold-customer", "true");
- PropertyBindingSupport.autowireSingletonPropertiesFromRegistry(context, foo);
+ PropertyBindingSupport.build().bind(context, foo, "name", "James");
+ PropertyBindingSupport.build().bind(context, foo, "bar.age", "33");
+ PropertyBindingSupport.build().bind(context, foo, "bar.rider", "true");
+ PropertyBindingSupport.build().bind(context, foo, "bar.gold-customer", "true");
+ PropertyBindingSupport.autowireSingletonPropertiesFromRegistry(context, foo, false, false, null);
assertEquals("James", foo.getName());
assertEquals(33, foo.getBar().getAge());
diff --git a/core/camel-core/src/test/java/org/apache/camel/support/PropertyBindingSupportAutowireTest.java b/core/camel-core/src/test/java/org/apache/camel/support/PropertyBindingSupportAutowireTest.java
index 5b33d61..2e7aa85 100644
--- a/core/camel-core/src/test/java/org/apache/camel/support/PropertyBindingSupportAutowireTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/support/PropertyBindingSupportAutowireTest.java
@@ -42,7 +42,7 @@ public class PropertyBindingSupportAutowireTest extends ContextTestSupport {
public void testAutowireProperties() throws Exception {
Foo foo = new Foo();
- PropertyBindingSupport.bindProperty(context, foo, "name", "James");
+ PropertyBindingSupport.build().bind(context, foo, "name", "James");
PropertyBindingSupport.autowireSingletonPropertiesFromRegistry(context, foo);
assertEquals("James", foo.getName());
diff --git a/core/camel-core/src/test/java/org/apache/camel/support/PropertyBindingSupportListTest.java b/core/camel-core/src/test/java/org/apache/camel/support/PropertyBindingSupportListTest.java
index 5579c64..8f9d3c87 100644
--- a/core/camel-core/src/test/java/org/apache/camel/support/PropertyBindingSupportListTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/support/PropertyBindingSupportListTest.java
@@ -64,7 +64,7 @@ public class PropertyBindingSupportListTest extends ContextTestSupport {
prop.put("bar.works[0]", "#bean:company1");
prop.put("bar.works[1]", "#bean:company2");
- PropertyBindingSupport.bindProperties(context, foo, prop);
+ PropertyBindingSupport.build().bind(context, foo, prop);
assertEquals("James", foo.getName());
assertEquals(33, foo.getBar().getAge());
@@ -91,7 +91,7 @@ public class PropertyBindingSupportListTest extends ContextTestSupport {
prop.put("bar.works[1]", "#bean:company2");
prop.put("bar.works[1].name", "I changed this");
- PropertyBindingSupport.bindProperties(context, foo, prop);
+ PropertyBindingSupport.build().bind(context, foo, prop);
assertEquals("James", foo.getName());
assertEquals(33, foo.getBar().getAge());
@@ -114,7 +114,7 @@ public class PropertyBindingSupportListTest extends ContextTestSupport {
prop.put("works[1]", "#bean:company2");
prop.put("works[1].name", "I changed this");
- PropertyBindingSupport.bindProperties(context, bar, prop);
+ PropertyBindingSupport.build().bind(context, bar, prop);
assertEquals(2, bar.getWorks().size());
assertEquals(666, bar.getWorks().get(0).getId());
@@ -133,7 +133,7 @@ public class PropertyBindingSupportListTest extends ContextTestSupport {
prop.put("bar.gold-customer[]", "true");
try {
- PropertyBindingSupport.bindProperties(context, foo, prop);
+ PropertyBindingSupport.build().bind(context, foo, prop);
fail("Should have thrown exception");
} catch (PropertyBindingException e) {
assertEquals("bar.gold-customer[]", e.getPropertyName());
diff --git a/core/camel-core/src/test/java/org/apache/camel/support/PropertyBindingSupportMapTest.java b/core/camel-core/src/test/java/org/apache/camel/support/PropertyBindingSupportMapTest.java
index 0acaa24..4586887 100644
--- a/core/camel-core/src/test/java/org/apache/camel/support/PropertyBindingSupportMapTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/support/PropertyBindingSupportMapTest.java
@@ -63,7 +63,7 @@ public class PropertyBindingSupportMapTest extends ContextTestSupport {
prop.put("bar.works[acme]", "#bean:company1");
prop.put("bar.works[burger]", "#bean:company2");
- PropertyBindingSupport.bindProperties(context, foo, prop);
+ PropertyBindingSupport.build().bind(context, foo, prop);
assertEquals("James", foo.getName());
assertEquals(33, foo.getBar().getAge());
@@ -90,7 +90,7 @@ public class PropertyBindingSupportMapTest extends ContextTestSupport {
prop.put("bar.works[burger]", "#bean:company2");
prop.put("bar.works[burger].name", "I changed this");
- PropertyBindingSupport.bindProperties(context, foo, prop);
+ PropertyBindingSupport.build().bind(context, foo, prop);
assertEquals("James", foo.getName());
assertEquals(33, foo.getBar().getAge());
@@ -113,7 +113,7 @@ public class PropertyBindingSupportMapTest extends ContextTestSupport {
prop.put("works[burger]", "#bean:company2");
prop.put("works[burger].name", "I changed this");
- PropertyBindingSupport.bindProperties(context, bar, prop);
+ PropertyBindingSupport.build().bind(context, bar, prop);
assertEquals(2, bar.getWorks().size());
assertEquals(666, bar.getWorks().get("acme").getId());
@@ -132,7 +132,7 @@ public class PropertyBindingSupportMapTest extends ContextTestSupport {
prop.put("bar.gold-customer[foo]", "true");
try {
- PropertyBindingSupport.bindProperties(context, foo, prop);
+ PropertyBindingSupport.build().bind(context, foo, prop);
fail("Should have thrown exception");
} catch (PropertyBindingException e) {
assertEquals("bar.gold-customer[foo]", e.getPropertyName());
diff --git a/core/camel-core/src/test/java/org/apache/camel/support/PropertyBindingSupportTest.java b/core/camel-core/src/test/java/org/apache/camel/support/PropertyBindingSupportTest.java
index 968961f..a417ccd 100644
--- a/core/camel-core/src/test/java/org/apache/camel/support/PropertyBindingSupportTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/support/PropertyBindingSupportTest.java
@@ -73,6 +73,35 @@ public class PropertyBindingSupportTest extends ContextTestSupport {
}
@Test
+ public void testWithFluentBuilder() throws Exception {
+ Foo foo = new Foo();
+
+ Map<String, Object> prop = new HashMap<>();
+ prop.put("bar.age", "33");
+ prop.put("bar.{{committer}}", "true");
+ prop.put("bar.gold-customer", "true");
+ prop.put("bar.work.name", "{{companyName}}");
+
+ PropertyBindingSupport.build()
+ .withCamelContext(context)
+ .withTarget(foo)
+ .withProperty("name", "James")
+ .withProperty("bar.work.id", "123")
+ // and add the rest
+ .withProperties(prop)
+ .bind();
+
+ assertEquals("James", foo.getName());
+ assertEquals(33, foo.getBar().getAge());
+ assertTrue(foo.getBar().isRider());
+ assertTrue(foo.getBar().isGoldCustomer());
+ assertEquals(123, foo.getBar().getWork().getId());
+ assertEquals("Acme", foo.getBar().getWork().getName());
+
+ assertTrue("Should bind all properties", prop.isEmpty());
+ }
+
+ @Test
public void testPropertiesIgnoreCase() throws Exception {
Foo foo = new Foo();
@@ -84,7 +113,7 @@ public class PropertyBindingSupportTest extends ContextTestSupport {
prop.put("bAr.work.ID", "123");
prop.put("bar.WORk.naME", "{{companyName}}");
- PropertyBindingSupport.bindProperties(context, foo, prop, true);
+ PropertyBindingSupport.build().withIgnoreCase(true).bind(context, foo, prop);
assertEquals("James", foo.getName());
assertEquals(33, foo.getBar().getAge());
@@ -109,7 +138,7 @@ public class PropertyBindingSupportTest extends ContextTestSupport {
prop.put("my.prefix.bar.work.name", "{{companyName}}");
prop.put("my.other.prefix.something", "test");
- PropertyBindingSupport.bindProperties(context, foo, prop, "my.prefix.");
+ PropertyBindingSupport.build().withOptionPrefix("my.prefix.").bind(context, foo, prop);
assertEquals("James", foo.getName());
assertEquals(33, foo.getBar().getAge());
@@ -134,7 +163,7 @@ public class PropertyBindingSupportTest extends ContextTestSupport {
prop.put("my.prEFIx.bar.Work.Name", "{{companyName}}");
prop.put("my.other.prefix.something", "test");
- PropertyBindingSupport.bindProperties(context, foo, prop, "my.prefix.", true);
+ PropertyBindingSupport.build().withOptionPrefix("my.prefix.").withIgnoreCase(true).bind(context, foo, prop);
assertEquals("James", foo.getName());
assertEquals(33, foo.getBar().getAge());
@@ -150,12 +179,12 @@ public class PropertyBindingSupportTest extends ContextTestSupport {
public void testNested() throws Exception {
Foo foo = new Foo();
- PropertyBindingSupport.bindProperty(context, foo, "name", "James");
- PropertyBindingSupport.bindProperty(context, foo, "bar.age", "33");
- PropertyBindingSupport.bindProperty(context, foo, "bar.{{committer}}", "true");
- PropertyBindingSupport.bindProperty(context, foo, "bar.gold-customer", "true");
- PropertyBindingSupport.bindProperty(context, foo, "bar.work.id", "123");
- PropertyBindingSupport.bindProperty(context, foo, "bar.work.name", "{{companyName}}");
+ PropertyBindingSupport.build().bind(context, foo, "name", "James");
+ PropertyBindingSupport.build().bind(context, foo, "bar.age", "33");
+ PropertyBindingSupport.build().bind(context, foo, "bar.{{committer}}", "true");
+ PropertyBindingSupport.build().bind(context, foo, "bar.gold-customer", "true");
+ PropertyBindingSupport.build().bind(context, foo, "bar.work.id", "123");
+ PropertyBindingSupport.build().bind(context, foo, "bar.work.name", "{{companyName}}");
assertEquals("James", foo.getName());
assertEquals(33, foo.getBar().getAge());
@@ -169,11 +198,11 @@ public class PropertyBindingSupportTest extends ContextTestSupport {
public void testNestedReference() throws Exception {
Foo foo = new Foo();
- PropertyBindingSupport.bindProperty(context, foo, "name", "James");
- PropertyBindingSupport.bindProperty(context, foo, "bar.age", "33");
- PropertyBindingSupport.bindProperty(context, foo, "bar.gold-customer", "true");
- PropertyBindingSupport.bindProperty(context, foo, "bar.rider", "true");
- PropertyBindingSupport.bindProperty(context, foo, "bar.work", "#bean:myWork");
+ PropertyBindingSupport.build().bind(context, foo, "name", "James");
+ PropertyBindingSupport.build().bind(context, foo, "bar.age", "33");
+ PropertyBindingSupport.build().bind(context, foo, "bar.gold-customer", "true");
+ PropertyBindingSupport.build().bind(context, foo, "bar.rider", "true");
+ PropertyBindingSupport.build().bind(context, foo, "bar.work", "#bean:myWork");
assertEquals("James", foo.getName());
assertEquals(33, foo.getBar().getAge());
@@ -187,11 +216,11 @@ public class PropertyBindingSupportTest extends ContextTestSupport {
public void testNestedReferenceId() throws Exception {
Foo foo = new Foo();
- PropertyBindingSupport.bindProperty(context, foo, "name", "James");
- PropertyBindingSupport.bindProperty(context, foo, "bar.age", "33");
- PropertyBindingSupport.bindProperty(context, foo, "bar.gold-customer", "true");
- PropertyBindingSupport.bindProperty(context, foo, "bar.rider", "true");
- PropertyBindingSupport.bindProperty(context, foo, "bar.work", "#bean:myWork");
+ PropertyBindingSupport.build().bind(context, foo, "name", "James");
+ PropertyBindingSupport.build().bind(context, foo, "bar.age", "33");
+ PropertyBindingSupport.build().bind(context, foo, "bar.gold-customer", "true");
+ PropertyBindingSupport.build().bind(context, foo, "bar.rider", "true");
+ PropertyBindingSupport.build().bind(context, foo, "bar.work", "#bean:myWork");
assertEquals("James", foo.getName());
assertEquals(33, foo.getBar().getAge());
@@ -205,11 +234,11 @@ public class PropertyBindingSupportTest extends ContextTestSupport {
public void testNestedType() throws Exception {
Foo foo = new Foo();
- PropertyBindingSupport.bindProperty(context, foo, "name", "James");
- PropertyBindingSupport.bindProperty(context, foo, "bar.age", "33");
- PropertyBindingSupport.bindProperty(context, foo, "bar.{{committer}}", "true");
- PropertyBindingSupport.bindProperty(context, foo, "bar.gold-customer", "true");
- PropertyBindingSupport.bindProperty(context, foo, "bar.work", "#type:org.apache.camel.support.Company");
+ PropertyBindingSupport.build().bind(context, foo, "name", "James");
+ PropertyBindingSupport.build().bind(context, foo, "bar.age", "33");
+ PropertyBindingSupport.build().bind(context, foo, "bar.{{committer}}", "true");
+ PropertyBindingSupport.build().bind(context, foo, "bar.gold-customer", "true");
+ PropertyBindingSupport.build().bind(context, foo, "bar.work", "#type:org.apache.camel.support.Company");
assertEquals("James", foo.getName());
assertEquals(33, foo.getBar().getAge());
@@ -223,11 +252,11 @@ public class PropertyBindingSupportTest extends ContextTestSupport {
public void testNestedClass() throws Exception {
Foo foo = new Foo();
- PropertyBindingSupport.bindProperty(context, foo, "name", "James");
- PropertyBindingSupport.bindProperty(context, foo, "bar.age", "33");
- PropertyBindingSupport.bindProperty(context, foo, "bar.{{committer}}", "true");
- PropertyBindingSupport.bindProperty(context, foo, "bar.gold-customer", "true");
- PropertyBindingSupport.bindProperty(context, foo, "bar.work", "#class:org.apache.camel.support.Company");
+ PropertyBindingSupport.build().bind(context, foo, "name", "James");
+ PropertyBindingSupport.build().bind(context, foo, "bar.age", "33");
+ PropertyBindingSupport.build().bind(context, foo, "bar.{{committer}}", "true");
+ PropertyBindingSupport.build().bind(context, foo, "bar.gold-customer", "true");
+ PropertyBindingSupport.build().bind(context, foo, "bar.work", "#class:org.apache.camel.support.Company");
assertEquals("James", foo.getName());
assertEquals(33, foo.getBar().getAge());
@@ -242,11 +271,11 @@ public class PropertyBindingSupportTest extends ContextTestSupport {
public void testAutowired() throws Exception {
Foo foo = new Foo();
- PropertyBindingSupport.bindProperty(context, foo, "name", "James");
- PropertyBindingSupport.bindProperty(context, foo, "bar.age", "33");
- PropertyBindingSupport.bindProperty(context, foo, "bar.{{committer}}", "true");
- PropertyBindingSupport.bindProperty(context, foo, "bar.gold-customer", "true");
- PropertyBindingSupport.bindProperty(context, foo, "bar.work", "#autowired");
+ PropertyBindingSupport.build().bind(context, foo, "name", "James");
+ PropertyBindingSupport.build().bind(context, foo, "bar.age", "33");
+ PropertyBindingSupport.build().bind(context, foo, "bar.{{committer}}", "true");
+ PropertyBindingSupport.build().bind(context, foo, "bar.gold-customer", "true");
+ PropertyBindingSupport.build().bind(context, foo, "bar.work", "#autowired");
assertEquals("James", foo.getName());
assertEquals(33, foo.getBar().getAge());
@@ -260,13 +289,13 @@ public class PropertyBindingSupportTest extends ContextTestSupport {
public void testMandatory() throws Exception {
Foo foo = new Foo();
- PropertyBindingSupport.bindMandatoryProperty(context, foo, "name", "James");
+ PropertyBindingSupport.build().withMandatory(true).bind(context, foo, "name", "James");
- boolean bound = PropertyBindingSupport.bindProperty(context, foo, "bar.myAge", "33");
+ boolean bound = PropertyBindingSupport.build().bind(context, foo, "bar.myAge", "33");
assertFalse(bound);
try {
- PropertyBindingSupport.bindMandatoryProperty(context, foo, "bar.myAge", "33");
+ PropertyBindingSupport.build().withMandatory(true).bind(context, foo, "bar.myAge", "33");
fail("Should have thrown exception");
} catch (PropertyBindingException e) {
assertEquals("bar.myAge", e.getPropertyName());
@@ -278,9 +307,9 @@ public class PropertyBindingSupportTest extends ContextTestSupport {
public void testDoesNotExistClass() throws Exception {
Foo foo = new Foo();
- PropertyBindingSupport.bindProperty(context, foo, "name", "James");
+ PropertyBindingSupport.build().bind(context, foo, "name", "James");
try {
- PropertyBindingSupport.bindProperty(context, foo, "bar.work", "#class:org.apache.camel.support.DoesNotExist");
+ PropertyBindingSupport.build().bind(context, foo, "bar.work", "#class:org.apache.camel.support.DoesNotExist");
fail("Should throw exception");
} catch (PropertyBindingException e) {
assertIsInstanceOf(ClassNotFoundException.class, e.getCause());
@@ -313,9 +342,9 @@ public class PropertyBindingSupportTest extends ContextTestSupport {
}
});
- PropertyBindingSupport.bindProperty(context, foo, "name", "James");
+ PropertyBindingSupport.build().bind(context, foo, "name", "James");
try {
- PropertyBindingSupport.bindProperty(context, foo, "bar.work", "#class:org.apache.camel.support.Company");
+ PropertyBindingSupport.build().bind(context, foo, "bar.work", "#class:org.apache.camel.support.Company");
fail("Should throw exception");
} catch (PropertyBindingException e) {
assertIsInstanceOf(IllegalStateException.class, e.getCause());
diff --git a/core/camel-main/src/main/java/org/apache/camel/main/MainSupport.java b/core/camel-main/src/main/java/org/apache/camel/main/MainSupport.java
index 1f1e6be..9d32d7d 100644
--- a/core/camel-main/src/main/java/org/apache/camel/main/MainSupport.java
+++ b/core/camel-main/src/main/java/org/apache/camel/main/MainSupport.java
@@ -804,7 +804,7 @@ public abstract class MainSupport extends ServiceSupport {
if (envEnabled == null) {
envEnabled = prop.remove("camel.main.auto-configuration-environment-variables-enabled");
if (envEnabled != null) {
- PropertyBindingSupport.bindMandatoryProperty(camelContext, mainConfigurationProperties, "autoConfigurationEnvironmentVariablesEnabled", envEnabled, true);
+ PropertyBindingSupport.build().withMandatory(true).withIgnoreCase(true).bind(camelContext, mainConfigurationProperties, "autoConfigurationEnvironmentVariablesEnabled", envEnabled);
autoConfiguredProperties.put("camel.main.auto-configuration-environment-variables-enabled", envEnabled.toString());
}
}
@@ -825,14 +825,14 @@ public abstract class MainSupport extends ServiceSupport {
// special for fail-fast as we need to know this early before we set all the other options
Object failFast = propENV != null ? propENV.remove("camel.main.autoconfigurationfailfast") : null;
if (failFast != null) {
- PropertyBindingSupport.bindMandatoryProperty(camelContext, mainConfigurationProperties, "autoConfigurationFailFast", failFast, true);
+ PropertyBindingSupport.build().withMandatory(true).withIgnoreCase(true).bind(camelContext, mainConfigurationProperties, "autoConfigurationFailFast", failFast);
} else {
failFast = prop.remove("camel.main.autoConfigurationFailFast");
if (failFast == null) {
failFast = prop.remove("camel.main.auto-configuration-fail-fast");
}
if (failFast != null) {
- PropertyBindingSupport.bindMandatoryProperty(camelContext, mainConfigurationProperties, "autoConfigurationFailFast", failFast, true);
+ PropertyBindingSupport.build().withMandatory(true).withIgnoreCase(true).bind(camelContext, mainConfigurationProperties, "autoConfigurationFailFast", failFast);
autoConfiguredProperties.put("camel.main.auto-configuration-fail-fast", failFast.toString());
}
}
@@ -1262,10 +1262,10 @@ public abstract class MainSupport extends ServiceSupport {
try {
boolean hit;
if (failIfNotSet) {
- PropertyBindingSupport.bindMandatoryProperty(context, target, name, stringValue, ignoreCase);
+ PropertyBindingSupport.build().withMandatory(true).withIgnoreCase(ignoreCase).bind(context, target, name, stringValue);
hit = true;
} else {
- hit = PropertyBindingSupport.bindProperty(context, target, name, stringValue, ignoreCase);
+ hit = PropertyBindingSupport.build().withIgnoreCase(true).bind(context, target, name, stringValue);
}
if (hit) {
it.remove();
diff --git a/core/camel-management-impl/src/main/java/org/apache/camel/management/JmxManagementStrategyFactory.java b/core/camel-management-impl/src/main/java/org/apache/camel/management/JmxManagementStrategyFactory.java
index 63b00c0..fbabb31 100644
--- a/core/camel-management-impl/src/main/java/org/apache/camel/management/JmxManagementStrategyFactory.java
+++ b/core/camel-management-impl/src/main/java/org/apache/camel/management/JmxManagementStrategyFactory.java
@@ -33,7 +33,7 @@ public class JmxManagementStrategyFactory implements ManagementStrategyFactory {
public ManagementStrategy create(CamelContext context, Map<String, Object> options) throws Exception {
DefaultManagementAgent agent = new DefaultManagementAgent(context);
if (options != null) {
- PropertyBindingSupport.bindProperties(context, agent, options);
+ PropertyBindingSupport.build().bind(context, agent, options);
}
return new JmxManagementStrategy(context, agent);
diff --git a/core/camel-support/src/main/java/org/apache/camel/component/extension/verifier/DefaultComponentVerifierExtension.java b/core/camel-support/src/main/java/org/apache/camel/component/extension/verifier/DefaultComponentVerifierExtension.java
index c473b77..148111c 100644
--- a/core/camel-support/src/main/java/org/apache/camel/component/extension/verifier/DefaultComponentVerifierExtension.java
+++ b/core/camel-support/src/main/java/org/apache/camel/component/extension/verifier/DefaultComponentVerifierExtension.java
@@ -187,7 +187,7 @@ public class DefaultComponentVerifierExtension implements ComponentVerifierExten
}
if (!properties.isEmpty()) {
- PropertyBindingSupport.bindProperties(camelContext, instance, properties);
+ PropertyBindingSupport.build().bind(camelContext, instance, properties);
}
return instance;
diff --git a/core/camel-support/src/main/java/org/apache/camel/support/DefaultComponent.java b/core/camel-support/src/main/java/org/apache/camel/support/DefaultComponent.java
index 0229404..ce0f8a8 100644
--- a/core/camel-support/src/main/java/org/apache/camel/support/DefaultComponent.java
+++ b/core/camel-support/src/main/java/org/apache/camel/support/DefaultComponent.java
@@ -398,7 +398,7 @@ public abstract class DefaultComponent extends ServiceSupport implements Compone
.bind(camelContext, bean, parameters);
} else {
// use advanced binding
- PropertyBindingSupport.bindProperties(camelContext, bean, parameters);
+ PropertyBindingSupport.build().bind(camelContext, bean, parameters);
}
}
diff --git a/core/camel-support/src/main/java/org/apache/camel/support/DefaultEndpoint.java b/core/camel-support/src/main/java/org/apache/camel/support/DefaultEndpoint.java
index 6d572c0..a57354f 100644
--- a/core/camel-support/src/main/java/org/apache/camel/support/DefaultEndpoint.java
+++ b/core/camel-support/src/main/java/org/apache/camel/support/DefaultEndpoint.java
@@ -416,7 +416,7 @@ public abstract class DefaultEndpoint extends ServiceSupport implements Endpoint
.bind(camelContext, bean, parameters);
} else {
// use advanced binding
- PropertyBindingSupport.bindProperties(camelContext, bean, parameters);
+ PropertyBindingSupport.build().bind(camelContext, bean, parameters);
}
}
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 f4b973c..b72a4fb 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
@@ -157,7 +157,7 @@ public final class EndpointHelper {
@Deprecated
public static void setProperties(CamelContext context, Object bean, Map<String, Object> parameters) throws Exception {
// use the property binding which can do more advanced configuration
- PropertyBindingSupport.bindProperties(context, bean, parameters);
+ PropertyBindingSupport.build().bind(context, bean, parameters);
}
/**
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 310042f..eec9564 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
@@ -17,6 +17,7 @@
package org.apache.camel.support;
import java.lang.reflect.Method;
+import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
@@ -59,6 +60,13 @@ public final class PropertyBindingSupport {
*/
public static class Builder {
+ // TODO: add fluent for camel context, target, properties map, property key/value
+
+ private CamelContext camelContext;
+ private Object target;
+ private Map<String, Object> properties;
+ private boolean removeParameters = true;
+ private boolean mandatory;
private boolean nesting = true;
private boolean deepNesting = true;
private boolean reference = true;
@@ -69,6 +77,64 @@ public final class PropertyBindingSupport {
private String optionPrefix;
/**
+ * CamelContext to be used
+ */
+ public Builder withCamelContext(CamelContext camelContext) {
+ this.camelContext = camelContext;
+ return this;
+ }
+
+ /**
+ * Target object that should have parameters bound
+ */
+ public Builder withTarget(Object target) {
+ this.target = target;
+ return this;
+ }
+
+ /**
+ * The properties to use for binding
+ */
+ public Builder withProperties(Map<String, Object> properties) {
+ if (this.properties == null) {
+ this.properties = properties;
+ } else {
+ // there may be existing options so add those if missing
+ // we need to mutate existing as we are may be removing bound properties
+ this.properties.forEach(properties::putIfAbsent);
+ this.properties = properties;
+ }
+ return this;
+ }
+
+ /**
+ * Adds property to use for binding
+ */
+ public Builder withProperty(String key, Object value) {
+ if (this.properties == null) {
+ this.properties = new LinkedHashMap<>();
+ }
+ this.properties.put(key, value);
+ return this;
+ }
+
+ /**
+ * Whether parameters should be removed when its bound
+ */
+ public Builder withRemoteParameters(boolean removeParameters) {
+ this.removeParameters = removeParameters;
+ return this;
+ }
+
+ /**
+ * Whether all parameters should be mandatory and successfully bound
+ */
+ public Builder withMandatory(boolean mandatory) {
+ this.mandatory = mandatory;
+ return this;
+ }
+
+ /**
* Whether nesting is in use
*/
public Builder withNesting(boolean nesting) {
@@ -138,18 +204,60 @@ public final class PropertyBindingSupport {
/**
* Binds the properties to the target object, and removes the property that was bound from properties.
*
+ * @return true if one or more properties was bound
+ */
+ public boolean bind() {
+ // mandatory parameters
+ org.apache.camel.util.ObjectHelper.notNull(camelContext, "camelContext");
+ org.apache.camel.util.ObjectHelper.notNull(target, "target");
+ org.apache.camel.util.ObjectHelper.notNull(properties, "properties");
+
+ return doBindProperties(camelContext, target, properties, optionPrefix, ignoreCase, removeParameters, mandatory,
+ nesting, deepNesting, fluentBuilder, allowPrivateSetter, reference, placeholder);
+ }
+
+ /**
+ * Binds the properties to the target object, and removes the property that was bound from properties.
+ *
* @param camelContext the camel context
* @param target the target object
* @param properties the properties where the bound properties will be removed from
* @return true if one or more properties was bound
*/
public boolean bind(CamelContext camelContext, Object target, Map<String, Object> properties) {
+ CamelContext context = camelContext != null ? camelContext : this.camelContext;
+ Object obj = target != null ? target : this.target;
+ Map<String, Object> prop = properties != null ? properties : this.properties;
+
+ // mandatory parameters
+ org.apache.camel.util.ObjectHelper.notNull(context, "camelContext");
+ org.apache.camel.util.ObjectHelper.notNull(obj, "target");
+ org.apache.camel.util.ObjectHelper.notNull(prop, "properties");
+
+ return doBindProperties(context, obj, prop, optionPrefix, ignoreCase, removeParameters, mandatory,
+ nesting, deepNesting, fluentBuilder, allowPrivateSetter, reference, placeholder);
+ }
+
+ /**
+ * Binds the property to the target object.
+ *
+ * @param camelContext the camel context
+ * @param target the target object
+ * @param key the property key
+ * @param value the property value
+ * @return true if the property was bound
+ */
+ public boolean bind(CamelContext camelContext, Object target, String key, Object value) {
org.apache.camel.util.ObjectHelper.notNull(camelContext, "camelContext");
org.apache.camel.util.ObjectHelper.notNull(target, "target");
- org.apache.camel.util.ObjectHelper.notNull(properties, "properties");
+ org.apache.camel.util.ObjectHelper.notNull(key, "key");
+ org.apache.camel.util.ObjectHelper.notNull(value, "value");
+
+ Map<String, Object> properties = Collections.singletonMap(key, value);
- return bindProperties(camelContext, target, properties, optionPrefix, ignoreCase, nesting, deepNesting,
- fluentBuilder, allowPrivateSetter, reference, placeholder);
+ // do not remove parameters as this is a single property
+ return doBindProperties(camelContext, target, properties, optionPrefix, ignoreCase, false, mandatory,
+ nesting, deepNesting, fluentBuilder, allowPrivateSetter, reference, placeholder);
}
}
@@ -287,56 +395,25 @@ public final class PropertyBindingSupport {
/**
* Binds the properties to the target object, and removes the property that was bound from properties.
+ * <p/>
+ * This method uses the default settings, and if you need to configure any setting then use
+ * the fluent builder {@link #build()} where each option can be customized, such as whether parameter
+ * should be removed, or whether options are mandatory etc.
*
* @param camelContext the camel context
* @param target the target object
* @param properties the properties where the bound properties will be removed from
* @return true if one or more properties was bound
- */
- public static boolean bindProperties(CamelContext camelContext, Object target, Map<String, Object> properties) {
- return bindProperties(camelContext, target, properties, null);
- }
-
- /**
- * Binds the properties to the target object, and removes the property that was bound from properties.
*
- * @param camelContext the camel context
- * @param target the target object
- * @param properties the properties where the bound properties will be removed from
- * @param ignoreCase whether to ignore case for property keys
- * @return true if one or more properties was bound
+ * @see #build()
*/
- public static boolean bindProperties(CamelContext camelContext, Object target, Map<String, Object> properties, boolean ignoreCase) {
- return bindProperties(camelContext, target, properties, null, ignoreCase, true, true, true, true, true, true);
- }
+ public static boolean bindProperties(CamelContext camelContext, Object target, Map<String, Object> properties) {
+ // mandatory parameters
+ org.apache.camel.util.ObjectHelper.notNull(camelContext, "camelContext");
+ org.apache.camel.util.ObjectHelper.notNull(target, "target");
+ org.apache.camel.util.ObjectHelper.notNull(properties, "properties");
- /**
- * Binds the properties with the given prefix to the target object, and removes the property that was bound from properties.
- * Note that the prefix is removed from the key before the property is bound.
- *
- * @param camelContext the camel context
- * @param target the target object
- * @param properties the properties where the bound properties will be removed from
- * @param optionPrefix the prefix used to filter properties
- * @return true if one or more properties was bound
- */
- public static boolean bindProperties(CamelContext camelContext, Object target, Map<String, Object> properties, String optionPrefix) {
- return bindProperties(camelContext, target, properties, optionPrefix, false);
- }
-
- /**
- * Binds the properties with the given prefix to the target object, and removes the property that was bound from properties.
- * Note that the prefix is removed from the key before the property is bound.
- *
- * @param camelContext the camel context
- * @param target the target object
- * @param properties the properties where the bound properties will be removed from
- * @param optionPrefix the prefix used to filter properties
- * @param ignoreCase whether to ignore case for property keys
- * @return true if one or more properties was bound
- */
- public static boolean bindProperties(CamelContext camelContext, Object target, Map<String, Object> properties, String optionPrefix, boolean ignoreCase) {
- return bindProperties(camelContext, target, properties, optionPrefix, ignoreCase, true, true, true, true, true, true);
+ return PropertyBindingSupport.build().bind(camelContext, target, properties);
}
/**
@@ -348,6 +425,8 @@ public final class PropertyBindingSupport {
* @param properties the properties where the bound properties will be removed from
* @param optionPrefix the prefix used to filter properties
* @param ignoreCase whether to ignore case for property keys
+ * @param removeParameter whether to remove bound parameters
+ * @param madatory whether all parameters must be bound
* @param nesting whether nesting is in use
* @param deepNesting whether deep nesting is in use, where Camel will attempt to walk as deep as possible by creating new objects in the OGNL graph if
* a property has a setter and the object can be created from a default no-arg constructor.
@@ -357,10 +436,10 @@ public final class PropertyBindingSupport {
* @param placeholder whether to use Camels property placeholder to resolve placeholders on keys and values
* @return true if one or more properties was bound
*/
- public static boolean bindProperties(CamelContext camelContext, Object target, Map<String, Object> properties,
- String optionPrefix, boolean ignoreCase,
- boolean nesting, boolean deepNesting, boolean fluentBuilder, boolean allowPrivateSetter,
- boolean reference, boolean placeholder) {
+ private static boolean doBindProperties(CamelContext camelContext, Object target, Map<String, Object> properties,
+ String optionPrefix, boolean ignoreCase, boolean removeParameter, boolean madatory,
+ boolean nesting, boolean deepNesting, boolean fluentBuilder, boolean allowPrivateSetter,
+ boolean reference, boolean placeholder) {
org.apache.camel.util.ObjectHelper.notNull(camelContext, "camelContext");
org.apache.camel.util.ObjectHelper.notNull(target, "target");
org.apache.camel.util.ObjectHelper.notNull(properties, "properties");
@@ -387,50 +466,17 @@ public final class PropertyBindingSupport {
key = key.substring(optionPrefix.length());
}
- if (bindProperty(camelContext, target, key, value, ignoreCase, nesting, deepNesting, fluentBuilder, allowPrivateSetter, reference, placeholder)) {
+ boolean bound = bindProperty(camelContext, target, key, value, ignoreCase, nesting, deepNesting, fluentBuilder, allowPrivateSetter, reference, placeholder);
+ if (bound && removeParameter) {
iter.remove();
rc = true;
}
- }
-
- return rc;
- }
-
- /**
- * Binds the property to the target object.
- *
- * @param camelContext the camel context
- * @param target the target object
- * @param name name of property
- * @param value value of property
- * @return true if property was bound, false otherwise
- * @throws PropertyBindingException is thrown if error binding property
- */
- public static boolean bindProperty(CamelContext camelContext, Object target, String name, Object value) throws PropertyBindingException {
- return bindProperty(camelContext, target, name, value, false);
- }
-
- /**
- * Binds the property to the target object.
- *
- * @param camelContext the camel context
- * @param target the target object
- * @param name name of property
- * @param value value of property
- * @param ignoreCase whether to ignore case for property keys
- * @return true if property was bound, false otherwise
- * @throws PropertyBindingException is thrown if error binding property
- */
- public static boolean bindProperty(CamelContext camelContext, Object target, String name, Object value, boolean ignoreCase) throws PropertyBindingException {
- try {
- if (target != null && name != null) {
- return setProperty(camelContext, target, name, value, false, ignoreCase, true, true, true, true, true, true);
+ if (madatory && !bound) {
+ throw new PropertyBindingException(target, key, value);
}
- } catch (Exception e) {
- throw new PropertyBindingException(target, name, value, e);
}
- return false;
+ return rc;
}
private static boolean bindProperty(CamelContext camelContext, Object target, String name, Object value,
@@ -447,43 +493,6 @@ public final class PropertyBindingSupport {
return false;
}
- /**
- * Binds the mandatory property to the target object (will fail if not set/bound).
- *
- * @param camelContext the camel context
- * @param target the target object
- * @param name name of property
- * @param value value of property
- * @throws PropertyBindingException is thrown if error binding property, or the property was not bound
- */
- public static void bindMandatoryProperty(CamelContext camelContext, Object target, String name, Object value) throws PropertyBindingException {
- bindMandatoryProperty(camelContext, target, name, value, false);
- }
-
- /**
- * Binds the mandatory property to the target object (will fail if not set/bound).
- *
- * @param camelContext the camel context
- * @param target the target object
- * @param name name of property
- * @param value value of property
- * @param ignoreCase whether to ignore case for property keys
- * @throws PropertyBindingException is thrown if error binding property, or the property was not bound
- */
- public static void bindMandatoryProperty(CamelContext camelContext, Object target, String name, Object value, boolean ignoreCase) throws PropertyBindingException {
- boolean bound;
- if (target != null && name != null) {
- try {
- bound = setProperty(camelContext, target, name, value, true, ignoreCase, true, true, true, true, true, true);
- } catch (Exception e) {
- throw new PropertyBindingException(target, name, value, e);
- }
- if (!bound) {
- throw new PropertyBindingException(target, name, value);
- }
- }
- }
-
private static boolean setProperty(CamelContext context, Object target, String name, Object value, boolean mandatory,
boolean ignoreCase, boolean nesting, boolean deepNesting, boolean fluentBuilder,
boolean allowPrivateSetter, boolean reference, boolean placeholder) throws Exception {
diff --git a/core/camel-support/src/main/java/org/apache/camel/support/RestProducerFactoryHelper.java b/core/camel-support/src/main/java/org/apache/camel/support/RestProducerFactoryHelper.java
index c3f8f94..7aa1135 100644
--- a/core/camel-support/src/main/java/org/apache/camel/support/RestProducerFactoryHelper.java
+++ b/core/camel-support/src/main/java/org/apache/camel/support/RestProducerFactoryHelper.java
@@ -75,11 +75,7 @@ public final class RestProducerFactoryHelper {
// component was not added to the context we can configure it
final Component newlyCreated = camelContext.getComponent(componentName, true, false);
- // need to make a copy of the component properties as
- // IntrospectionSupport::setProperties will remove any that are set and
- // we might be called multiple times
- final Map<String, Object> copyOfComponentProperties = new LinkedHashMap<>(componentProperties);
- PropertyBindingSupport.bindProperties(camelContext, newlyCreated, copyOfComponentProperties);
+ PropertyBindingSupport.build().withRemoteParameters(false).bind(camelContext, newlyCreated, componentProperties);
ServiceHelper.startService(newlyCreated);
return newlyCreated;
diff --git a/core/camel-support/src/main/java/org/apache/camel/support/ScheduledPollConsumer.java b/core/camel-support/src/main/java/org/apache/camel/support/ScheduledPollConsumer.java
index c816fc9..c620048 100644
--- a/core/camel-support/src/main/java/org/apache/camel/support/ScheduledPollConsumer.java
+++ b/core/camel-support/src/main/java/org/apache/camel/support/ScheduledPollConsumer.java
@@ -420,11 +420,11 @@ public abstract class ScheduledPollConsumer extends DefaultConsumer implements R
// configure scheduler with options from this consumer
Map<String, Object> properties = new LinkedHashMap<>();
IntrospectionSupport.getProperties(this, properties, null);
- PropertyBindingSupport.bindProperties(getEndpoint().getCamelContext(), scheduler, properties);
+ PropertyBindingSupport.build().bind(getEndpoint().getCamelContext(), scheduler, properties);
if (schedulerProperties != null && !schedulerProperties.isEmpty()) {
// need to use a copy in case the consumer is restarted so we keep the properties
Map<String, Object> copy = new LinkedHashMap<>(schedulerProperties);
- PropertyBindingSupport.bindProperties(getEndpoint().getCamelContext(), scheduler, copy);
+ PropertyBindingSupport.build().bind(getEndpoint().getCamelContext(), scheduler, copy);
if (copy.size() > 0) {
throw new FailedToCreateConsumerException(getEndpoint(), "There are " + copy.size()
+ " scheduler parameters that couldn't be set on the endpoint."
diff --git a/core/camel-support/src/main/java/org/apache/camel/support/component/AbstractApiComponent.java b/core/camel-support/src/main/java/org/apache/camel/support/component/AbstractApiComponent.java
index c5ddd02..ad68368 100644
--- a/core/camel-support/src/main/java/org/apache/camel/support/component/AbstractApiComponent.java
+++ b/core/camel-support/src/main/java/org/apache/camel/support/component/AbstractApiComponent.java
@@ -113,7 +113,7 @@ public abstract class AbstractApiComponent<E extends Enum<E> & ApiName, T, S ext
// create endpoint configuration with component properties
final T endpointConfiguration = collection.getEndpointConfiguration(name);
- PropertyBindingSupport.bindProperties(getCamelContext(), endpointConfiguration, componentProperties);
+ PropertyBindingSupport.build().bind(getCamelContext(), endpointConfiguration, componentProperties);
return endpointConfiguration;
}