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

davsclaus pushed a commit to branch bl-val
in repository https://gitbox.apache.org/repos/asf/camel.git

commit bd9d1d9590190618c8845f825b16bda51e5eed12
Author: Claus Ibsen <claus.ib...@gmail.com>
AuthorDate: Sat Sep 30 08:39:09 2023 +0200

    CAMEL-19934: camel-bean - Add validate option to turn off method validation
---
 .../org/apache/camel/catalog/languages/bean.json   |  7 +++--
 .../org/apache/camel/catalog/models/method.json    |  7 +++--
 .../apache/camel/catalog/schemas/camel-spring.xsd  |  9 ++++++
 .../org/apache/camel/language/bean/bean.json       |  7 +++--
 .../apache/camel/language/bean/BeanExpression.java | 21 ++++++++++----
 .../apache/camel/language/bean/BeanLanguage.java   | 20 +++++++++++++-
 .../org/apache/camel/spi/ComponentCustomizer.java  | 10 +++----
 .../org/apache/camel/spi/DataFormatCustomizer.java | 10 +++----
 .../org/apache/camel/model/language/method.json    |  7 +++--
 .../camel/model/language/MethodCallExpression.java | 32 ++++++++++++++++++++++
 .../language/MethodCallExpressionReifier.java      |  5 ++--
 .../java/org/apache/camel/xml/in/ModelParser.java  |  1 +
 .../java/org/apache/camel/xml/out/ModelWriter.java |  1 +
 .../org/apache/camel/yaml/out/ModelWriter.java     |  1 +
 .../dsl/yaml/deserializers/ModelDeserializers.java |  8 +++++-
 .../generated/resources/schema/camelYamlDsl.json   |  5 ++++
 16 files changed, 119 insertions(+), 32 deletions(-)

diff --git 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/languages/bean.json
 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/languages/bean.json
index 844daeea529..577348e6b59 100644
--- 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/languages/bean.json
+++ 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/languages/bean.json
@@ -20,8 +20,9 @@
     "method": { "index": 1, "kind": "attribute", "displayName": "Method", 
"required": false, "type": "string", "javaType": "java.lang.String", 
"deprecated": false, "autowired": false, "secret": false, "description": "Name 
of method to call" },
     "beanType": { "index": 2, "kind": "attribute", "displayName": "Bean Type", 
"required": false, "type": "string", "javaType": "java.lang.String", 
"deprecated": false, "autowired": false, "secret": false, "description": "Class 
name (fully qualified) of the bean to use Will lookup in registry and if there 
is a single instance of the same type, then the existing bean is used, 
otherwise a new bean is created (requires a default no-arg constructor)." },
     "scope": { "index": 3, "kind": "attribute", "displayName": "Scope", 
"label": "advanced", "required": false, "type": "enum", "javaType": 
"java.lang.String", "enum": [ "Singleton", "Request", "Prototype" ], 
"deprecated": false, "autowired": false, "secret": false, "defaultValue": 
"Singleton", "description": "Scope of bean. When using singleton scope 
(default) the bean is created or looked up only once and reused for the 
lifetime of the endpoint. The bean should be thread-safe in case c [...]
-    "resultType": { "index": 4, "kind": "attribute", "displayName": "Result 
Type", "required": false, "type": "string", "javaType": "java.lang.String", 
"deprecated": false, "autowired": false, "secret": false, "description": "Sets 
the class of the result type (type from output)" },
-    "trim": { "index": 5, "kind": "attribute", "displayName": "Trim", "label": 
"advanced", "required": false, "type": "boolean", "javaType": 
"java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": true, "description": "Whether to trim the value to remove 
leading and trailing whitespaces and line breaks" },
-    "id": { "index": 6, "kind": "attribute", "displayName": "Id", "required": 
false, "type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": false, "description": "Sets the id of this node" }
+    "validate": { "index": 4, "kind": "attribute", "displayName": "Validate", 
"label": "advanced", "required": false, "type": "boolean", "javaType": 
"java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": true, "description": "Whether to validate the bean has the 
configured method." },
+    "resultType": { "index": 5, "kind": "attribute", "displayName": "Result 
Type", "required": false, "type": "string", "javaType": "java.lang.String", 
"deprecated": false, "autowired": false, "secret": false, "description": "Sets 
the class of the result type (type from output)" },
+    "trim": { "index": 6, "kind": "attribute", "displayName": "Trim", "label": 
"advanced", "required": false, "type": "boolean", "javaType": 
"java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": true, "description": "Whether to trim the value to remove 
leading and trailing whitespaces and line breaks" },
+    "id": { "index": 7, "kind": "attribute", "displayName": "Id", "required": 
false, "type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": false, "description": "Sets the id of this node" }
   }
 }
diff --git 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/method.json
 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/method.json
index eb19403fd05..25ffcdfa2fc 100644
--- 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/method.json
+++ 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/method.json
@@ -17,8 +17,9 @@
     "method": { "index": 1, "kind": "attribute", "displayName": "Method", 
"required": false, "type": "string", "javaType": "java.lang.String", 
"deprecated": false, "autowired": false, "secret": false, "description": "Name 
of method to call" },
     "beanType": { "index": 2, "kind": "attribute", "displayName": "Bean Type", 
"required": false, "type": "string", "javaType": "java.lang.String", 
"deprecated": false, "autowired": false, "secret": false, "description": "Class 
name (fully qualified) of the bean to use Will lookup in registry and if there 
is a single instance of the same type, then the existing bean is used, 
otherwise a new bean is created (requires a default no-arg constructor)." },
     "scope": { "index": 3, "kind": "attribute", "displayName": "Scope", 
"label": "advanced", "required": false, "type": "enum", "javaType": 
"java.lang.String", "enum": [ "Singleton", "Request", "Prototype" ], 
"deprecated": false, "autowired": false, "secret": false, "defaultValue": 
"Singleton", "description": "Scope of bean. When using singleton scope 
(default) the bean is created or looked up only once and reused for the 
lifetime of the endpoint. The bean should be thread-safe in case c [...]
-    "resultType": { "index": 4, "kind": "attribute", "displayName": "Result 
Type", "required": false, "type": "string", "javaType": "java.lang.String", 
"deprecated": false, "autowired": false, "secret": false, "description": "Sets 
the class of the result type (type from output)" },
-    "trim": { "index": 5, "kind": "attribute", "displayName": "Trim", "label": 
"advanced", "required": false, "type": "boolean", "javaType": 
"java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": true, "description": "Whether to trim the value to remove 
leading and trailing whitespaces and line breaks" },
-    "id": { "index": 6, "kind": "attribute", "displayName": "Id", "required": 
false, "type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": false, "description": "Sets the id of this node" }
+    "validate": { "index": 4, "kind": "attribute", "displayName": "Validate", 
"label": "advanced", "required": false, "type": "boolean", "javaType": 
"java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": true, "description": "Whether to validate the bean has the 
configured method." },
+    "resultType": { "index": 5, "kind": "attribute", "displayName": "Result 
Type", "required": false, "type": "string", "javaType": "java.lang.String", 
"deprecated": false, "autowired": false, "secret": false, "description": "Sets 
the class of the result type (type from output)" },
+    "trim": { "index": 6, "kind": "attribute", "displayName": "Trim", "label": 
"advanced", "required": false, "type": "boolean", "javaType": 
"java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": true, "description": "Whether to trim the value to remove 
leading and trailing whitespaces and line breaks" },
+    "id": { "index": 7, "kind": "attribute", "displayName": "Id", "required": 
false, "type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": false, "description": "Sets the id of this node" }
   }
 }
diff --git 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd
 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd
index 50cbdb3590e..d94d85f3d8d 100644
--- 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd
+++ 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd
@@ -15787,6 +15787,15 @@ request. When using prototype scope, then the bean 
will be looked up or created
 this is delegated to the bean registry such as Spring or CDI (if in use), 
which depends on their configuration can act
 as either singleton or prototype scope. So when using prototype scope then 
this depends on the bean registry
 implementation. Default value: Singleton
+]]>
+            </xs:documentation>
+          </xs:annotation>
+        </xs:attribute>
+        <xs:attribute name="validate" type="xs:string">
+          <xs:annotation>
+            <xs:documentation xml:lang="en">
+<![CDATA[
+Whether to validate the bean has the configured method. Default value: true
 ]]>
             </xs:documentation>
           </xs:annotation>
diff --git 
a/components/camel-bean/src/generated/resources/org/apache/camel/language/bean/bean.json
 
b/components/camel-bean/src/generated/resources/org/apache/camel/language/bean/bean.json
index 844daeea529..577348e6b59 100644
--- 
a/components/camel-bean/src/generated/resources/org/apache/camel/language/bean/bean.json
+++ 
b/components/camel-bean/src/generated/resources/org/apache/camel/language/bean/bean.json
@@ -20,8 +20,9 @@
     "method": { "index": 1, "kind": "attribute", "displayName": "Method", 
"required": false, "type": "string", "javaType": "java.lang.String", 
"deprecated": false, "autowired": false, "secret": false, "description": "Name 
of method to call" },
     "beanType": { "index": 2, "kind": "attribute", "displayName": "Bean Type", 
"required": false, "type": "string", "javaType": "java.lang.String", 
"deprecated": false, "autowired": false, "secret": false, "description": "Class 
name (fully qualified) of the bean to use Will lookup in registry and if there 
is a single instance of the same type, then the existing bean is used, 
otherwise a new bean is created (requires a default no-arg constructor)." },
     "scope": { "index": 3, "kind": "attribute", "displayName": "Scope", 
"label": "advanced", "required": false, "type": "enum", "javaType": 
"java.lang.String", "enum": [ "Singleton", "Request", "Prototype" ], 
"deprecated": false, "autowired": false, "secret": false, "defaultValue": 
"Singleton", "description": "Scope of bean. When using singleton scope 
(default) the bean is created or looked up only once and reused for the 
lifetime of the endpoint. The bean should be thread-safe in case c [...]
-    "resultType": { "index": 4, "kind": "attribute", "displayName": "Result 
Type", "required": false, "type": "string", "javaType": "java.lang.String", 
"deprecated": false, "autowired": false, "secret": false, "description": "Sets 
the class of the result type (type from output)" },
-    "trim": { "index": 5, "kind": "attribute", "displayName": "Trim", "label": 
"advanced", "required": false, "type": "boolean", "javaType": 
"java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": true, "description": "Whether to trim the value to remove 
leading and trailing whitespaces and line breaks" },
-    "id": { "index": 6, "kind": "attribute", "displayName": "Id", "required": 
false, "type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": false, "description": "Sets the id of this node" }
+    "validate": { "index": 4, "kind": "attribute", "displayName": "Validate", 
"label": "advanced", "required": false, "type": "boolean", "javaType": 
"java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": true, "description": "Whether to validate the bean has the 
configured method." },
+    "resultType": { "index": 5, "kind": "attribute", "displayName": "Result 
Type", "required": false, "type": "string", "javaType": "java.lang.String", 
"deprecated": false, "autowired": false, "secret": false, "description": "Sets 
the class of the result type (type from output)" },
+    "trim": { "index": 6, "kind": "attribute", "displayName": "Trim", "label": 
"advanced", "required": false, "type": "boolean", "javaType": 
"java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": true, "description": "Whether to trim the value to remove 
leading and trailing whitespaces and line breaks" },
+    "id": { "index": 7, "kind": "attribute", "displayName": "Id", "required": 
false, "type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": false, "description": "Sets the id of this node" }
   }
 }
diff --git 
a/components/camel-bean/src/main/java/org/apache/camel/language/bean/BeanExpression.java
 
b/components/camel-bean/src/main/java/org/apache/camel/language/bean/BeanExpression.java
index 9c6c7ac6504..572914f35bd 100644
--- 
a/components/camel-bean/src/main/java/org/apache/camel/language/bean/BeanExpression.java
+++ 
b/components/camel-bean/src/main/java/org/apache/camel/language/bean/BeanExpression.java
@@ -66,6 +66,7 @@ public class BeanExpression implements Expression, Predicate {
     private BeanHolder beanHolder;
     private boolean ognlMethod;
     private BeanScope scope = BeanScope.Singleton;
+    private boolean validate = true;
 
     public BeanExpression(Object bean, String method) {
         this.bean = bean;
@@ -112,6 +113,14 @@ public class BeanExpression implements Expression, 
Predicate {
         this.scope = scope;
     }
 
+    public boolean isValidate() {
+        return validate;
+    }
+
+    public void setValidate(boolean validate) {
+        this.validate = validate;
+    }
+
     public ParameterMappingStrategy getParameterMappingStrategy() {
         return parameterMappingStrategy;
     }
@@ -169,13 +178,13 @@ public class BeanExpression implements Expression, 
Predicate {
         // lets see if we can do additional validation that the bean has valid 
method during creation of the expression
         Object target = beanHolder.getBean(null);
         if (method != null) {
-            validateHasMethod(context, target, type, method);
-
-            // validate OGNL if its invalid syntax
-            if (OgnlHelper.isInvalidValidOgnlExpression(method)) {
-                throw new ExpressionIllegalSyntaxException(method);
+            if (validate) {
+                validateHasMethod(context, target, type, method);
+                // validate OGNL if its invalid syntax
+                if (OgnlHelper.isInvalidValidOgnlExpression(method)) {
+                    throw new ExpressionIllegalSyntaxException(method);
+                }
             }
-
             ognlMethod = OgnlHelper.isValidOgnlExpression(method);
         }
     }
diff --git 
a/components/camel-bean/src/main/java/org/apache/camel/language/bean/BeanLanguage.java
 
b/components/camel-bean/src/main/java/org/apache/camel/language/bean/BeanLanguage.java
index a7f81d280ab..6ab6066a684 100644
--- 
a/components/camel-bean/src/main/java/org/apache/camel/language/bean/BeanLanguage.java
+++ 
b/components/camel-bean/src/main/java/org/apache/camel/language/bean/BeanLanguage.java
@@ -69,6 +69,7 @@ public class BeanLanguage extends TypedLanguageSupport 
implements ScriptingLangu
     private String ref;
     private String method;
     private BeanScope scope = BeanScope.Singleton;
+    private boolean validate = true;
 
     public BeanLanguage() {
     }
@@ -113,6 +114,14 @@ public class BeanLanguage extends TypedLanguageSupport 
implements ScriptingLangu
         this.scope = scope;
     }
 
+    public boolean isValidate() {
+        return validate;
+    }
+
+    public void setValidate(boolean validate) {
+        this.validate = validate;
+    }
+
     @Override
     public boolean configure(CamelContext camelContext, Object target, String 
name, Object value, boolean ignoreCase) {
         if (target != this) {
@@ -135,6 +144,9 @@ public class BeanLanguage extends TypedLanguageSupport 
implements ScriptingLangu
             case "scope":
                 setScope(PropertyConfigurerSupport.property(camelContext, 
BeanScope.class, value));
                 return true;
+            case "validate":
+                setValidate(PropertyConfigurerSupport.property(camelContext, 
Boolean.class, value));
+                return true;
             case "resultType":
             case "resulttype":
                 setResultType(PropertyConfigurerSupport.property(camelContext, 
Class.class, value));
@@ -186,7 +198,13 @@ public class BeanLanguage extends TypedLanguageSupport 
implements ScriptingLangu
                 answer.setScope(BeanScope.valueOf(scope.toString()));
             }
         }
-        answer.setResultType(property(Class.class, properties, 5, 
getResultType()));
+        if (properties.length >= 6) {
+            Object validate = properties[5];
+            if (validate != null) {
+                answer.setValidate(Boolean.parseBoolean(validate.toString()));
+            }
+        }
+        answer.setResultType(property(Class.class, properties, 6, 
getResultType()));
         answer.setBeanComponent(beanComponent);
         answer.setParameterMappingStrategy(parameterMappingStrategy);
         answer.setSimple(simple);
diff --git 
a/core/camel-api/src/main/java/org/apache/camel/spi/ComponentCustomizer.java 
b/core/camel-api/src/main/java/org/apache/camel/spi/ComponentCustomizer.java
index 63e41ccae46..2daf2c260ac 100644
--- a/core/camel-api/src/main/java/org/apache/camel/spi/ComponentCustomizer.java
+++ b/core/camel-api/src/main/java/org/apache/camel/spi/ComponentCustomizer.java
@@ -205,11 +205,11 @@ public interface ComponentCustomizer extends Ordered {
                 return this.condition != null
                         ? this.condition
                         : new BiPredicate<>() {
-                    @Override
-                    public boolean test(String s, Component language) {
-                        return true;
-                    }
-                };
+                            @Override
+                            public boolean test(String s, Component language) {
+                                return true;
+                            }
+                        };
             }
 
             if (condition == null) {
diff --git 
a/core/camel-api/src/main/java/org/apache/camel/spi/DataFormatCustomizer.java 
b/core/camel-api/src/main/java/org/apache/camel/spi/DataFormatCustomizer.java
index e764f351767..12aaece25ca 100644
--- 
a/core/camel-api/src/main/java/org/apache/camel/spi/DataFormatCustomizer.java
+++ 
b/core/camel-api/src/main/java/org/apache/camel/spi/DataFormatCustomizer.java
@@ -205,11 +205,11 @@ public interface DataFormatCustomizer extends Ordered {
                 return this.condition != null
                         ? this.condition
                         : new BiPredicate<>() {
-                    @Override
-                    public boolean test(String s, DataFormat language) {
-                        return true;
-                    }
-                };
+                            @Override
+                            public boolean test(String s, DataFormat language) 
{
+                                return true;
+                            }
+                        };
             }
 
             if (condition == null) {
diff --git 
a/core/camel-core-model/src/generated/resources/org/apache/camel/model/language/method.json
 
b/core/camel-core-model/src/generated/resources/org/apache/camel/model/language/method.json
index eb19403fd05..25ffcdfa2fc 100644
--- 
a/core/camel-core-model/src/generated/resources/org/apache/camel/model/language/method.json
+++ 
b/core/camel-core-model/src/generated/resources/org/apache/camel/model/language/method.json
@@ -17,8 +17,9 @@
     "method": { "index": 1, "kind": "attribute", "displayName": "Method", 
"required": false, "type": "string", "javaType": "java.lang.String", 
"deprecated": false, "autowired": false, "secret": false, "description": "Name 
of method to call" },
     "beanType": { "index": 2, "kind": "attribute", "displayName": "Bean Type", 
"required": false, "type": "string", "javaType": "java.lang.String", 
"deprecated": false, "autowired": false, "secret": false, "description": "Class 
name (fully qualified) of the bean to use Will lookup in registry and if there 
is a single instance of the same type, then the existing bean is used, 
otherwise a new bean is created (requires a default no-arg constructor)." },
     "scope": { "index": 3, "kind": "attribute", "displayName": "Scope", 
"label": "advanced", "required": false, "type": "enum", "javaType": 
"java.lang.String", "enum": [ "Singleton", "Request", "Prototype" ], 
"deprecated": false, "autowired": false, "secret": false, "defaultValue": 
"Singleton", "description": "Scope of bean. When using singleton scope 
(default) the bean is created or looked up only once and reused for the 
lifetime of the endpoint. The bean should be thread-safe in case c [...]
-    "resultType": { "index": 4, "kind": "attribute", "displayName": "Result 
Type", "required": false, "type": "string", "javaType": "java.lang.String", 
"deprecated": false, "autowired": false, "secret": false, "description": "Sets 
the class of the result type (type from output)" },
-    "trim": { "index": 5, "kind": "attribute", "displayName": "Trim", "label": 
"advanced", "required": false, "type": "boolean", "javaType": 
"java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": true, "description": "Whether to trim the value to remove 
leading and trailing whitespaces and line breaks" },
-    "id": { "index": 6, "kind": "attribute", "displayName": "Id", "required": 
false, "type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": false, "description": "Sets the id of this node" }
+    "validate": { "index": 4, "kind": "attribute", "displayName": "Validate", 
"label": "advanced", "required": false, "type": "boolean", "javaType": 
"java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": true, "description": "Whether to validate the bean has the 
configured method." },
+    "resultType": { "index": 5, "kind": "attribute", "displayName": "Result 
Type", "required": false, "type": "string", "javaType": "java.lang.String", 
"deprecated": false, "autowired": false, "secret": false, "description": "Sets 
the class of the result type (type from output)" },
+    "trim": { "index": 6, "kind": "attribute", "displayName": "Trim", "label": 
"advanced", "required": false, "type": "boolean", "javaType": 
"java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": true, "description": "Whether to trim the value to remove 
leading and trailing whitespaces and line breaks" },
+    "id": { "index": 7, "kind": "attribute", "displayName": "Id", "required": 
false, "type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": false, "description": "Sets the id of this node" }
   }
 }
diff --git 
a/core/camel-core-model/src/main/java/org/apache/camel/model/language/MethodCallExpression.java
 
b/core/camel-core-model/src/main/java/org/apache/camel/model/language/MethodCallExpression.java
index 240020ddf23..fb867e1b1c1 100644
--- 
a/core/camel-core-model/src/main/java/org/apache/camel/model/language/MethodCallExpression.java
+++ 
b/core/camel-core-model/src/main/java/org/apache/camel/model/language/MethodCallExpression.java
@@ -47,6 +47,9 @@ public class MethodCallExpression extends 
TypedExpressionDefinition {
     @XmlAttribute
     @Metadata(label = "advanced", defaultValue = "Singleton", enums = 
"Singleton,Request,Prototype")
     private String scope;
+    @XmlAttribute
+    @Metadata(label = "advanced", defaultValue = "true", javaType = 
"java.lang.Boolean")
+    private String validate;
 
     public MethodCallExpression() {
     }
@@ -96,6 +99,7 @@ public class MethodCallExpression extends 
TypedExpressionDefinition {
         this.method = builder.method;
         this.beanTypeName = builder.beanTypeName;
         this.scope = builder.scope;
+        this.validate = builder.validate;
     }
 
     @Override
@@ -169,6 +173,17 @@ public class MethodCallExpression extends 
TypedExpressionDefinition {
         this.scope = scope;
     }
 
+    public String getValidate() {
+        return validate;
+    }
+
+    /**
+     * Whether to validate the bean has the configured method.
+     */
+    public void setValidate(String validate) {
+        this.validate = validate;
+    }
+
     public Object getInstance() {
         return instance;
     }
@@ -214,6 +229,7 @@ public class MethodCallExpression extends 
TypedExpressionDefinition {
         private String method;
         private String beanTypeName;
         private String scope;
+        private String validate;
 
         /**
          * Name of method to call
@@ -278,6 +294,22 @@ public class MethodCallExpression extends 
TypedExpressionDefinition {
             return this;
         }
 
+        /**
+         * Whether to validate the bean has the configured method.
+         */
+        public Builder validate(String validate) {
+            this.validate = validate;
+            return this;
+        }
+
+        /**
+         * Whether to validate the bean has the configured method.
+         */
+        public Builder validate(boolean validate) {
+            this.validate = Boolean.toString(validate);
+            return this;
+        }
+
         @Override
         public MethodCallExpression end() {
             return new MethodCallExpression(this);
diff --git 
a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/language/MethodCallExpressionReifier.java
 
b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/language/MethodCallExpressionReifier.java
index 1794c7f2de8..70bbbf58757 100644
--- 
a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/language/MethodCallExpressionReifier.java
+++ 
b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/language/MethodCallExpressionReifier.java
@@ -30,13 +30,14 @@ public class MethodCallExpressionReifier extends 
TypedExpressionReifier<MethodCa
 
     @Override
     protected Object[] createProperties() {
-        Object[] properties = new Object[6];
+        Object[] properties = new Object[7];
         properties[0] = definition.getInstance();
         properties[1] = parseString(definition.getMethod());
         properties[2] = definition.getBeanType();
         properties[3] = parseString(definition.getRef());
         properties[4] = parseString(definition.getScope());
-        properties[5] = definition.getResultType();
+        properties[5] = definition.getValidate();
+        properties[6] = definition.getResultType();
         return properties;
     }
 
diff --git 
a/core/camel-xml-io/src/generated/java/org/apache/camel/xml/in/ModelParser.java 
b/core/camel-xml-io/src/generated/java/org/apache/camel/xml/in/ModelParser.java
index 3e06002b2b6..75abe87c86b 100644
--- 
a/core/camel-xml-io/src/generated/java/org/apache/camel/xml/in/ModelParser.java
+++ 
b/core/camel-xml-io/src/generated/java/org/apache/camel/xml/in/ModelParser.java
@@ -2853,6 +2853,7 @@ public class ModelParser extends BaseParser {
                 case "method": def.setMethod(val); break;
                 case "ref": def.setRef(val); break;
                 case "scope": def.setScope(val); break;
+                case "validate": def.setValidate(val); break;
                 default: return 
typedExpressionDefinitionAttributeHandler().accept(def, key, val);
             }
             return true;
diff --git 
a/core/camel-xml-io/src/generated/java/org/apache/camel/xml/out/ModelWriter.java
 
b/core/camel-xml-io/src/generated/java/org/apache/camel/xml/out/ModelWriter.java
index 275afafab9c..3085681d84a 100644
--- 
a/core/camel-xml-io/src/generated/java/org/apache/camel/xml/out/ModelWriter.java
+++ 
b/core/camel-xml-io/src/generated/java/org/apache/camel/xml/out/ModelWriter.java
@@ -3930,6 +3930,7 @@ public class ModelWriter extends BaseWriter {
         doWriteAttribute("method", def.getMethod());
         doWriteAttribute("scope", def.getScope());
         doWriteAttribute("beanType", def.getBeanTypeName());
+        doWriteAttribute("validate", def.getValidate());
         doWriteValue(def.getExpression());
         endElement(name);
     }
diff --git 
a/core/camel-yaml-io/src/generated/java/org/apache/camel/yaml/out/ModelWriter.java
 
b/core/camel-yaml-io/src/generated/java/org/apache/camel/yaml/out/ModelWriter.java
index cd2bdb66105..82e928bc44c 100644
--- 
a/core/camel-yaml-io/src/generated/java/org/apache/camel/yaml/out/ModelWriter.java
+++ 
b/core/camel-yaml-io/src/generated/java/org/apache/camel/yaml/out/ModelWriter.java
@@ -3930,6 +3930,7 @@ public class ModelWriter extends BaseWriter {
         doWriteAttribute("method", def.getMethod());
         doWriteAttribute("scope", def.getScope());
         doWriteAttribute("beanType", def.getBeanTypeName());
+        doWriteAttribute("validate", def.getValidate());
         doWriteValue(def.getExpression());
         endElement(name);
     }
diff --git 
a/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/ModelDeserializers.java
 
b/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/ModelDeserializers.java
index 5a701d28af0..c0b4a019284 100644
--- 
a/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/ModelDeserializers.java
+++ 
b/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/ModelDeserializers.java
@@ -9091,7 +9091,8 @@ public final class ModelDeserializers extends 
YamlDeserializerSupport {
                     @YamlProperty(name = "ref", type = "string", description = 
"Reference to an existing bean (bean id) to lookup in the registry", 
displayName = "Ref"),
                     @YamlProperty(name = "result-type", type = "string", 
description = "Sets the class of the result type (type from output)", 
displayName = "Result Type"),
                     @YamlProperty(name = "scope", type = 
"enum:Singleton,Request,Prototype", defaultValue = "Singleton", description = 
"Scope of bean. When using singleton scope (default) the bean is created or 
looked up only once and reused for the lifetime of the endpoint. The bean 
should be thread-safe in case concurrent threads is calling the bean at the 
same time. When using request scope the bean is created or looked up once per 
request (exchange). This can be used if you want to s [...]
-                    @YamlProperty(name = "trim", type = "boolean", description 
= "Whether to trim the value to remove leading and trailing whitespaces and 
line breaks", displayName = "Trim")
+                    @YamlProperty(name = "trim", type = "boolean", description 
= "Whether to trim the value to remove leading and trailing whitespaces and 
line breaks", displayName = "Trim"),
+                    @YamlProperty(name = "validate", type = "boolean", 
description = "Whether to validate the bean has the configured method.", 
displayName = "Validate")
             }
     )
     public static class MethodCallExpressionDeserializer extends 
YamlDeserializerBase<MethodCallExpression> {
@@ -9148,6 +9149,11 @@ public final class ModelDeserializers extends 
YamlDeserializerSupport {
                     target.setTrim(val);
                     break;
                 }
+                case "validate": {
+                    String val = asText(node);
+                    target.setValidate(val);
+                    break;
+                }
                 default: {
                     ExpressionDefinition ed = target.getExpressionType();
                     if (ed != null) {
diff --git 
a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl.json
 
b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl.json
index 8742989d9e2..15d6837cf97 100644
--- 
a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl.json
+++ 
b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl.json
@@ -12896,6 +12896,11 @@
               "type" : "boolean",
               "title" : "Trim",
               "description" : "Whether to trim the value to remove leading and 
trailing whitespaces and line breaks"
+            },
+            "validate" : {
+              "type" : "boolean",
+              "title" : "Validate",
+              "description" : "Whether to validate the bean has the configured 
method."
             }
           }
         } ]

Reply via email to