Use Instance Type of EDataType [message #689757] |
Tue, 28 June 2011 05:45  |
Eclipse User |
|
|
|
Hi all,
I've created some Java class (let it be MyClass). Then I've created an ecore metamodel (MM1) and EDataType with Instance Type Name equals MyClass within the metamodel. If then i create an EClass (Class1) with an attribute (attribute1) of this EDataType, how can work out this attribute during the ATL transformation?
E.g. I have an attribute name of MyClass, and I want to map Class1 of MM1 into Class2 of some metamodel MM2 with the ATL transformation. Let the name (java field) of attribute1 to be mapped into the name (ecore attribute) of Class2.
Can I write something like:
rule MatchClasses {
from
i : MM1!Class1
to
o : MM2!Class2 (
name <- i.attribute1.name
)
}
So the problem is that the "name" is java field of java class MyClass, not ecore attribute of some EClass. Is there any possibility to extract data from Instance Type of EDataType during ATL transformation?
I'll really appreciate any thoughts. Thank you in advance!
|
|
|
|
|
|
|
Re: Use Instance Type of EDataType [message #695764 is a reply to message #694442] |
Tue, 12 July 2011 09:59  |
Eclipse User |
|
|
|
Hi Sylvain,
Could you please clarify what a getter is? Should I create an EOperation, let it be getName(), in MM1!Class1?
How can I implement that getName() should return MM1!Class1.attribute.name?
Should I generate .genmodel and then Java code from the .genmodel, and then implement the method getName() in Class1Impl.java?
How can I "tell" ATL to process the MM1.ecore with Java packages generated from .genmodel if the previous answer is yes?
And why if Class1 contains attribute "attribute1" of some EDataType (with its Instance Type Name equals MyClass), the MM1!Class1.attribute1.oclType() returns OclAny instead of MyClass?
If you have any good tutorials on these features, please, send me some links..
Thank you very much in advance!
|
|
|
Powered by
FUDForum. Page generated in 1.02663 seconds