Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-13294

Properties component - Add easy method to lookup via key

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 3.0.0-M2, 3.0.0
    • camel-core
    • None
    • Unknown

    Description

      Lets make this code a bit easier, and have a nicer API on the PropertiesComponent we have in camel-api now for Camel 3

                              // 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);
                              }
      

      Attachments

        Issue Links

          Activity

            People

              davsclaus Claus Ibsen
              davsclaus Claus Ibsen
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: