You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Claus Ibsen (JIRA)" <ji...@apache.org> on 2011/03/25 18:14:05 UTC

[jira] [Resolved] (CAMEL-3515) Improve the bean parameter binding parameterType option

     [ https://issues.apache.org/jira/browse/CAMEL-3515?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen resolved CAMEL-3515.
--------------------------------

       Resolution: Fixed
    Fix Version/s:     (was: 3.0.0)

I will mark this as resolved. We can later create a ticket if we want to consider supporting being able to specify default values for parameters in the methodName option.

> Improve the bean parameter binding parameterType option
> -------------------------------------------------------
>
>                 Key: CAMEL-3515
>                 URL: https://issues.apache.org/jira/browse/CAMEL-3515
>             Project: Camel
>          Issue Type: Sub-task
>          Components: camel-core
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>            Priority: Minor
>             Fix For: 2.8.0
>
>         Attachments: diff_1056749_1056745.txt
>
>
> We need this new feature documented
> http://camel.apache.org/bean
> And we need this option on the these
> - MethodCallExpression
> - BeanExpression
> And we need unit tests which uses the method call expression in
> - camel-core
> - camel-spring
> Also the String -> Class converter should use the ClassResolver API from CamelContext. This ensure it runs in OSGi, JBoss, J2EE etc.
> What you do is just add Exchange as the 2nd parameter and Camel provides it to you
> {code}
>     /**
>      * Returns the converted value, or null if the value is null
>      */
>     @SuppressWarnings("rawtypes")
>     @Converter
>     public static Class toClass(Object value, Exchange exchange) {
>         if (value instanceof Class) {
>             return (Class) value;
>         } else if (value instanceof String) {
>             // prefer to use class resolver API
>             if (exchange != null) {
>                 return exchange.getContext().getClassResolver().resolveClass((String) value);
>             } else {
>                 return ObjectHelper.loadClass((String) value);
>             }
>         } else {
>             return null;
>         }
>     }
> {code}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira