[
https://issues.apache.org/jira/browse/CAMEL-13294?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Claus Ibsen resolved CAMEL-13294.
---------------------------------
Resolution: Fixed
> Properties component - Add easy method to lookup via key
> --------------------------------------------------------
>
> Key: CAMEL-13294
> URL: https://issues.apache.org/jira/browse/CAMEL-13294
> Project: Camel
> Issue Type: Improvement
> Components: camel-core
> Reporter: Claus Ibsen
> Assignee: Claus Ibsen
> Priority: Major
> Fix For: 3.0.0, 3.0.0-M2
>
>
> Lets make this code a bit easier, and have a nicer API on the
> PropertiesComponent we have in camel-api now for Camel 3
> {code}
> // build key with default value included as this is
> supported during resolving
> String key = pi.value();
> if (!isEmpty(pi.defaultValue())) {
> key = key + ":" + pi.defaultValue();
> }
> // need to force property lookup by having key
> enclosed in tokens
> key =
> camelContext.getPropertiesComponent().getPrefixToken() + key +
> camelContext.getPropertiesComponent().getSuffixToken();
> try {
> Object value =
> camelContext.resolvePropertyPlaceholders(key);
> parameters[i] =
> camelContext.getTypeConverter().convertTo(type, value);
> } catch (Exception e) {
> throw
> RuntimeCamelException.wrapRuntimeCamelException(e);
> }
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)