[Acceleo] How to make a type cast? [message #1018839] |
Thu, 14 March 2013 10:58  |
Eclipse User |
|
|
|
Hi,
I am using Acceleo with a meta-model with some inherited classes. Imagine classes 'child1' and 'child2' inherit from 'parent'.
I want to do this:
[for (_par : Parent | aModel.eAllContents()->filter(Parent))]
_par.parentattribute1 [comment write parent attributes of the class/]
[if (_par.oclIsTypeOf(child1))]
[(child1) _par;/] [comment this does not work!!/]
_par.child1attribute1 [comment write child1 attributes of the class/]
[/if]
[if (_par.oclIsTypeOf(child2))]
[(child2) _par;/] [comment this does not work!!/]
_par.child2attribute1 [comment write child2 attributes of the class/]
[/if]
[/for]
As far as I know, to be able to read an attribute defined in a child class I need to cast my object to be seen by acceleo as a child class, and I do not know how to do this. I tried this in different ways, for example the one above, but this is not accepted by acceleo.
Do you know how to do it?
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.25448 seconds