camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Umair Saleem (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CAMEL-8738) Referring to constants using type
Date Mon, 04 May 2015 11:38:06 GMT

    [ https://issues.apache.org/jira/browse/CAMEL-8738?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14526549#comment-14526549
] 

Umair Saleem commented on CAMEL-8738:
-------------------------------------

I used inner classes for organization/management of my code. My Constant can contain inner
class of DbConstants, date Formats etc. Otherwise I have make separate classes of all my constants.
How could I achieve this from within the framework ?

public class Constants {

    public static String system ="dev";

    public static class DbConstants{ 
        public static String fieldName = "fieldName" 
    }
    public static class DataFormat{ 
        public static String format= "dd/mm/yyyy"
        public static String format1 = "dd/mm/yyyy HH" 
    }


}

> Referring to constants using type
> ---------------------------------
>
>                 Key: CAMEL-8738
>                 URL: https://issues.apache.org/jira/browse/CAMEL-8738
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-language
>    Affects Versions: 2.15.0
>         Environment: Windows 7
>            Reporter: Umair Saleem
>            Priority: Minor
>             Fix For: 2.15.0
>
>
> 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.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message