[ATL] Call an operation [message #106892] |
Fri, 19 June 2009 08:54  |
Eclipse User |
|
|
|
Hello,
I'm working on a higher order transformation, with the following scenario:
*** (T1 - HOT): M1 -> ATL ***
- from M1 I get the string of the operations I need to call in the
generated T2 transformation, on the input types of T2.
*** (T2): M2 -> M3 (with the use of an ATL library) ***
- some target elements in M3 need to be constructed by calling on M2
types, operations defined in an ATL library for those types, these
operations being identified, inside a helper, by a String parameter,
belonging to the helper.
Sample:
rule A {
|
|
|
Re: [ATL] Call an operation by a string [message #106909 is a reply to message #106892] |
Fri, 19 June 2009 09:01   |
Eclipse User |
|
|
|
Hello,
Sorry for the incomplete post (new keyboard).
I'm working on a higher order transformation, with the following scenario:
*** (T1 - HOT): M1 -> ATL ***
- from M1 I get the string of the operations I need to call in the
generated T2 transformation, on the input types of T2.
*** (T2): M2 -> M3 (with the use of an ATL library) ***
- some target elements in M3 need to be constructed by calling on M2 types
(all of them), operations defined in an ATL library for those types, these
operations being identified, inside a helper, by a String parameter,
belonging to the helper.
Sample:
--this will lool like the generated code
uses Utils;
rule R {
from
a:M2!TypeM2
to
b:M3!TypeM3 (
value <- thisModule.getValue(operationName)
)
}
helper def : getValue(operationName : String) :String =
M2!TypeM2.allInstances()-> collect(it|it.'operationName').iterate(e;res:String=''|res.c oncat(e));
in which the operation is defined on the type M2 in the Utils library.
I really don't know if it's clear, please ask to clarify. Thank you!
Best regards,
Cosmin
|
|
|
Re: [ATL] Call an operation by a string [message #106936 is a reply to message #106909] |
Fri, 19 June 2009 09:15  |
Eclipse User |
|
|
|
Kind of reflection if you like and invoke a method on a type, by knowing
its name.
As an alternative of doing this, I could generate rules or just ouput
patterns for all of the strings I need to pass from M1 to T2. This way, in
each rule, I can write the operation corresponding to the string directly.
But this will be a lot of generated code an I was wondering how to pass
the collection of strings and have a general helper, which takes as
parameter one string at a time, to do my job.
Regards,
Cosmin
|
|
|
Powered by
FUDForum. Page generated in 0.03841 seconds