where can I learn ATL for handling java metamodel [message #783794] |
Thu, 26 January 2012 08:29  |
Eclipse User |
|
|
|
Hello community,
I am new here and try to transform one java project to another one. I have read all available online information and found this cool demo video posted in New MoDisco presentation and demo available online [message #727468]
Now my question is: where can I get the information about using ATL for handling the java metamodel like it is used in the video?
for example, if I want to replace one annotation of a field with another one, how to write the atl script?
...
@Foo
private SomeClass some;
after the transformation:
...
@Bar
private SomeClass some;
any online tutorial or books? Thanks.
best regards
Jing
|
|
|
Re: where can I learn ATL for handling java metamodel [message #783807 is a reply to message #783794] |
Thu, 26 January 2012 09:05   |
Eclipse User |
|
|
|
Hello Jing,
Thanks for using the MoDisco Java metamodel and corresponding model discoverer. Your feedback is always appreciated.
Answering to your question, there is nothing specific about ATL for handling Java models: the related Java metamodel is simply one metamodel (defined using Ecore) among others.
The demo video you mentioned just shows some transformations that can be quickly implemented in ATL.
Of course, they can be used as base references to implement more elaborated transformations on Java models.
If your problem is about the structure of the Java metamodel, I strongly encourage you to take a look to the MoDisco documentation to have a better overview of what's in there: http://download.eclipse.org/modeling/mdt/modisco/doc/org.eclipse.modisco.doc/
To learn the Java metamodel, the best solution is to automatically discover some Java models (out of Java projects) and to navigate them thanks to the MoDisco Model Browser.
If your problem is about the use of the ATL language itself, then you should post your question on the Modeling M2M forum by putting the [ATL] tag in the subject.
Anyway, just as a quick idea, you could use a simple rule like this one in your transformation:
rule ModifyTagElement {
from
ite : Java!TagElement (
ite.refImmediateComposite()
.refImmediateComposite()
.oclIsTypeOf(Java!FieldDeclaration)
and
ite.tagName = 'Foo'
)
to
ote : Java!TagElement (
tagName <- 'Bar'
)
}
Best regards,
Hugo
|
|
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.29935 seconds