This is an automated email from the ASF dual-hosted git repository. acosentino pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
commit 7752ac22bce7b78c1d3122b77279b04dac76c76a Author: Andrea Cosentino <anco...@gmail.com> AuthorDate: Tue Aug 11 16:18:15 2020 +0200 Sync and regen --- camel-dependencies/pom.xml | 2 +- docs/components/modules/others/pages/main.adoc | 48 ++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/camel-dependencies/pom.xml b/camel-dependencies/pom.xml index e79a96d..f1947c1 100644 --- a/camel-dependencies/pom.xml +++ b/camel-dependencies/pom.xml @@ -71,7 +71,7 @@ <awaitility-version>4.0.3</awaitility-version> <aws-java-sdk-swf-libs>1.11.22</aws-java-sdk-swf-libs> <aws-java-sdk-version>1.11.714</aws-java-sdk-version> - <aws-java-sdk2-version>2.13.71</aws-java-sdk2-version> + <aws-java-sdk2-version>2.13.72</aws-java-sdk2-version> <aws-xray-version>2.6.1</aws-xray-version> <axiom-version>1.2.14</axiom-version> <azure-storage-blob-java-sdk12-version>12.7.0</azure-storage-blob-java-sdk12-version> diff --git a/docs/components/modules/others/pages/main.adoc b/docs/components/modules/others/pages/main.adoc index cfc4020..5b7ff5f 100644 --- a/docs/components/modules/others/pages/main.adoc +++ b/docs/components/modules/others/pages/main.adoc @@ -280,6 +280,54 @@ Then we can create a bean instance with name `foo` and provide parameters to the camel.beans.foo = #class:com.foo.MyBean("Hello World", true, 123) ---- +=== Optional parameters on beans + +If a parameter on a bean is not mandatory then the parameter can be marked as optional using `?` syntax, as shown: + +[source,properties] +---- +camel.beans.foo = #class:com.foo.MyBean("Hello World", true, 123) +camel.beans.foo.?company = Acme +---- + +Then the company parameter is only set if `MyBean` has this option (silent ignore if no option present). +Otherwise if a parameter is set and the bean does not have such a parameter, then an exception is thrown by Camel. + +=== Nested parameters on beans + +You can configure nested parameters separating them via `.` (dot). + +For example given this `Country` class: + +[source,java] +---- +public class Country { + private String iso; + private String name; + + public void setIso(String iso) { + this.iso = iso; + } + + public void setName(String name) { + this.name = name; + } +} +---- + +Which is an option on the `MyBean` class. +Then we can then configure its iso and name parameter as shown below: + +[source,properties] +---- +camel.beans.foo = #class:com.foo.MyBean("Hello World", true, 123) +camel.beans.foo.country.iso = USA +camel.beans.foo.country.name = United States of America +---- + +Camel will automatic create an instance of `Country` if `MyBean` has a getter/setter for this option, and that the `Country` bean +has a default no-arg constructor. + === Configuring singleton beans by their type In the example above the SQL component was configured with the name of the `DataSource`. There can be situations where you know there is only