[Acceleo 3] GetKeywords & GetEannotation [message #543774] |
Wed, 30 June 2010 10:21  |
Eclipse User |
|
|
|
hi!
I have some troubles with the getkeywords & GetEannotation methods.
I want to filter my "objects" in my model. I want to get only the objects with a specific keyword ("test") specified in my model .
In a M2T template, i get the model, and after i get all the "ownedelements" of the model.
For each ownedelement i want to know if it have the specific keyword.
When i do my if/else in my template, it doesn't work.
When i just want to print the result of my condition it's print "true" ...
I really don't understand....
the code :
m is the model
[for (el : Element | m.ownedElement) ]
[if el.getEAnnotation('http://www.eclipse.org/uml2/2.0.0/UML').eGet('details').eGet('key').equalsIgnoreCase('test') ]
Condition Eannotation Good
[/if]
[if el.getKeywords().equalsIgnoreCase('test') ]
Condition KeyWord Good
[/if]
Type : [el.getEAnnotation('http://www.eclipse.org/uml2/2.0.0/UML').eGet('details').eGet('key').toString()/] == test
Eannotation => True/False [el.getEAnnotation('http://www.eclipse.org/uml2/2.0.0/UML').eGet('details').eGet('key').equalsIgnoreCase('test')/]
Keyword => True/False [el.getKeywords().equalsIgnoreCase('test')/]
[/for]
The result :
//This one have not the "specific" keyword
Type : org.eclipse.emf.ecore.impl.DynamicEObjectImpl@ebb12c (eClass: org.eclipse.emf.ecore.impl.EClassImpl@1bcd5b7 (name: Invalid_Class) (instanceClassName: null) (abstract: false, interface: false)) == test
Eannotation => True/False org.eclipse.emf.ecore.impl.DynamicEObjectImpl@ebb12c (eClass: org.eclipse.emf.ecore.impl.EClassImpl@1bcd5b7 (name: Invalid_Class) (instanceClassName: null) (abstract: false, interface: false))
Keyword => True/False
#####################################
//this one HAVE the specific keyword
Type : test == test
Eannotation => True/False true
Keyword => True/False true
#####################################
Thank for help
Benoît
[Updated on: Wed, 30 June 2010 10:28] by Moderator
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.11978 seconds