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

Referring to constants using type

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Not A Problem
    • 2.15.0
    • 2.15.0
    • camel-language
    • None
    • Windows 7

    • Moderate

    Description

      Hi,

      In documentation link http://camel.apache.org/simple.html following is written

      Camel 2.11: To refer to a type or field by its FQN name. To refer to a field you can append .FIELD_NAME. For example you can refer to the constant field from Exchange as: org.apache.camel.Exchange.FILE_NAME

      When I tried it it works.

      But for example I have class Constants which contain inner class InnerConstants which have a field. I cannot access it from following way.
      ${type:Constants.InnerConstants.fieldName}.

      Exception Found: Cannot find class Constants.InnerConstants.fieldName

      Following is the structure of my Constant class

      class Constants {
      public static String test ="Test1234";
      public static class InnerConstants

      { public static String fieldName = "fieldName" }

      }

      My route was:

      <route>
      <camel:from uri="stream:in" />
      <camel:setBody><simple>${type:Constants.InnerConstants.fieldName}</simple></camel:setBody>
      <log loggingLevel="INFO" message="${body}" />
      </route>

      Let me know if you need any other clarification.

      Attachments

        Activity

          People

            davsclaus Claus Ibsen
            umairsaleemid Umair Saleem
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: