camel-issues mailing list archives

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


Claus Ibsen commented on CAMEL-10600:

So maybe only if any of the regular setter didn't match nicely it can attempt a fallback with
type conversion based on the parameter types of the setters.

> IntrospectionSupport no longer does type conversion on references
> -----------------------------------------------------------------
>                 Key: CAMEL-10600
>                 URL:
>             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
> 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

This message was sent by Atlassian JIRA

View raw message