camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Ibsen (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (CAMEL-10600) IntrospectionSupport no longer does type conversion on references
Date Fri, 16 Dec 2016 10:19:58 GMT

    [ https://issues.apache.org/jira/browse/CAMEL-10600?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15754036#comment-15754036
] 

Claus Ibsen edited comment on CAMEL-10600 at 12/16/16 10:19 AM:
----------------------------------------------------------------

This is not so idel to do a type conversion of the reference, as there may be overloaded setter
methods and you need to find the best match to use first that are not doing unnecessary type
conversions.


was (Author: davsclaus):
This is not so idea to do a type conversion of the reference, as there may be overloaded setter
methods and you need to find the best match to use first that are not doing unnecessary type
conversions.

> IntrospectionSupport no longer does type conversion on references
> -----------------------------------------------------------------
>
>                 Key: CAMEL-10600
>                 URL: https://issues.apache.org/jira/browse/CAMEL-10600
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-core
>    Affects Versions: 2.18.1
>            Reporter: Greg Vanore
>            Priority: Minor
>
> I had noticed that {{IntrospectionSupport}} uses the type converter system, so was hoping
to inject my application config POJOs and then have them converted to the appropriate type
for certain properties where the configuration is on a per-object basis.
> My test setup was...
> # ... create a route, {{from("file://tmp/test?noop=true&idempotentRepository=#foo")}}.
> # ... add a bean to my test registry, {{Runnable}} with name {{foo}}.
> # ... register a converter that took a {{Runnable}} and just hardcoded a {{MemoryIdempotentRepository}}
as the result. I know this is strange but I just wanted to prove the conversion took place.
> Conversion didn't take place, so I set a breakpoint and took a look at {{IntrospectionSupport}}.
(2.18.1) On lines 531-534, a little bit of logic makes sure that the reference is the exact
type of the setter, or the setter is skipped. This effectively aborts type conversions for
references.
> I did a casual check through history, looks like this was introduced around 2.13.0.
> The most obvious workaround for this is for us to use a {{CompositeRegistry}} and use
an established nomenclature (e.g. {{accountName/idempotentRepository}} for us to do the fetch
and conversion in one spot.
> If you deem this a non-feature, it would be nice to at least pass the parameter type
to the {{CamelContextHelper#lookup}} utility. That way, when we write our custom registry,
the lookups will supply a type hint (e.g. {{lookupByNameAndType}} instead of just {{lookupByName}}.
Then we won't be forced to come up with a nomenclature that we have to parse, or we could
choose to make a generic {{TypeConverterRegistry}} that does a lookup by name and then a mandatory
conversion.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message