You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (JIRA)" <ji...@apache.org> on 2019/03/06 12:50:00 UTC

[jira] [Created] (CAMEL-13294) Properties component - Add easy method to lookup via key

Claus Ibsen created CAMEL-13294:
-----------------------------------

             Summary: 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
             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)