[Acceleo] Does the Acceleo Language support constants? [message #701821] |
Mon, 25 July 2011 16:26 |
|
Hello everybody
I need to use some string values in more than one module (.mtl file) in my project. I am looking for a way to define macros or constants in a single place and use them in multiple places (much like the #define directive of C's preprocessor). I checked let blocks, but I don't think the variables defined by them can be used in different modules. I think that defining a number of queries each returning the appropriate value would be a way to centralize the definition of a fixed value that can be used in multiple modules, but doesn't seem too elegant to me.
Does any expert in Acceleo know about a way to define constants?
Thanks. Kindest regards.
/TB
|
|
|
|
Re: (no subject) [message #702328 is a reply to message #701835] |
Tue, 26 July 2011 08:17 |
|
Hi,
Defining a set of queries returning the accurate String in their own module sure is one way to do it, but it does not seem like the easiest. If what you need are String constants, then the best way would be to define them in a properties file, and use these properties directly from your Acceleo module.
Stéphane had written a good post about how to use properties files with Acceleo 3.1 on his blog.
I'll only add that to access properties from an Acceleo module after you've followed his steps, you need to use one of the "getProperty" services the Acceleo syntax provides. See their definitions on the Acceleo operations reference.
Laurent Goubet
Obeo
|
|
|
Powered by
FUDForum. Page generated in 0.02083 seconds