[ATL]How to get the element type by the element's attribute? [message #87797] |
Thu, 07 August 2008 17:44  |
Eclipse User |
|
|
|
Originally posted by: zhuangguotao.hotmail.com
Hello, experts,
I want to ask to how to get the element type by the element's attribute?
for example,
<ElementA name="a1">
How to write a helper to get the element type which is ElementA by the
value of the name attribute.
Even, how to write a helper to execute the ElementA's helper based on the
value of the name attribute?
Best regards.
Zhuang
|
|
|
|
|
|
|
|
|
Re: [ATL]How to get the element type by the element's attribute? [message #88927 is a reply to message #88824] |
Mon, 25 August 2008 10:34  |
Eclipse User |
|
|
|
"Zhuang" <zhuangguotao@hotmail.com> schreef in bericht
news:37b9cfe239a5f3ecd4e770d356aaa1e6$1@www.eclipse.org...
> Thanks a lot for your atttention.
>
> I want to ask two questions:
>
> 1. is the getRefValue the function of ATL? if can I directly use it in
> ATL?
it's called refGetValue, sorry.
You can call it on any model element to get the property with the name you
supply as argument.
> 2. Can you tell me the theory about this sentence?
> features : "%EMF"!EStructuralFeature <-
> c.oclType().eStructuralFeatures->union(t.eSuperTypes->collect(st |
> thisModule.allFeatures(st))->flatten()->asSet());
> what mean is the %EMF, c, t?
This is just a reference to the EMOF metamodel
> Could you give me a sample about the usage about the reflection like your
> description.
self.oclType().eStructuralFeatures->union(t.eSuperTypes->collect(st |
thisModule.allFeatures(st))->flatten()->asSet()) -> iterate(f ; res : String
= ' -> ' |
let val : OclAny = self.refGetValue(f.name) in
val.debug('The value of '+ f.oclType().toString() +' '+ f.name +' from
model element "'+ self.toString() +'" is');
This will print:
The value of %EMF!EAttribute name from model element UML!Class is:
SomeClassName
The value of %EMF!EReference parents from model element UML!Class is:
%EMF!Class
I hope thats clear,
regards,
Alfons
|
|
|
Powered by
FUDForum. Page generated in 0.46203 seconds