Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » Problem with using annotations in acceleo(Problem with using annotations in acceleo)
Problem with using annotations in acceleo [message #666082] Tue, 19 April 2011 02:10 Go to next message
ramesh  is currently offline ramesh Friend
Messages: 1
Registered: April 2011
Junior Member
Hi all, i'm very new to acceleo, for text generation i'm using ecore file and .mtl module.

in my application there is a need of annotations, so i declared annotations in my ecore model.but problem is i'm unable to check if condition with my annotation details( key,value) in mtl file.

my condition in .mtl file is

[if(r.getEAnnotation('sourcename').details.key.equalsIgnoreC ase('keyname'))] [/if]

but here condition expression is not accepting in if block and even not accepting in let block also.

i'm able to print the values of my annotation source details(key,value) and even i'm able to print true or flase value of condition.

if any one know solution of this problem please replay me

Thanks, R.Ramesh
Re: Problem with using annotations in acceleo [message #666665 is a reply to message #666082] Thu, 21 April 2011 13:48 Go to previous message
Stephane Begaudeau is currently offline Stephane BegaudeauFriend
Messages: 450
Registered: April 2010
Location: Nantes (France)
Senior Member

Hi Ramesh,

This expression "r.getEAnnotation('sourcename').details" returns a collection so the condition of your "if" is a collection of boolean, not a boolean. You could change it to something like:

- [if(r.getEAnnotation('sourcename').details->first().key.equalsIgnoreCase('keyname'))] [/if]
-[if(r.getEAnnotation('sourcename').details->collect(key.equalsIgnoreC ase('keyname'))->size() > 0)] [/if]

Stephane Begaudeau, Obeo
Twitter: @sbegaudeau
Acceleo wiki:
Blogs: &

Previous Topic:[acceleo] The template parameter type cannot be resolved
Next Topic:[Xpand] Workflow execution programatically
Goto Forum:

Current Time: Thu Apr 26 13:34:48 GMT 2018

Powered by FUDForum. Page generated in 0.01770 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software