Home » Modeling » MDT (Model Development Tools) » UML2 MOFM2T API DOC?(Is there an API Doc for uml2/5.0.0/UML anywhere?)
UML2 MOFM2T API DOC? [message #1755151] |
Tue, 28 February 2017 08:49  |
Eclipse User |
|
|
|
Hello,
I am trying to set up a code generator for an Android NDK-project using Acceleo.
While there seem to be plenty of tutorials with code snippets, I have yet to find an API DOC
for the eclipse.org/uml2/5.0.0/UML metamodel.
I tried code completion from within Eclipse with something like
[template public foo(c : Class)]
...
c. (now press Ctrl + Space)
...
[/template]
but to no avail.
Isn't there any document that is like the Java API Doc, listing all functions and attributes (not just the ones used by chance in certain tutorials) for
a specific Type (like class, operation, attribute, stereotype, package, etc.) best with a short description of what they do?
Thank you very much for your help.
Best
Philip.
|
|
| | |
Re: UML2 MOFM2T API DOC? [message #1755169 is a reply to message #1755152] |
Tue, 28 February 2017 11:57   |
Eclipse User |
|
|
|
First of all thank you both for your quick and informative answers.
I beg your pardon, that I postet in the wrong Forum;
I am still not sure, if this is about UML or MOFM2T or Acceleo.
Maybe a little more details would have been great.
I have already read those
https://wiki.eclipse.org/Acceleo/Getting_Started
http://www.omg.org/spec/MOFM2T/1.0/PDF/
http://www.omg.org/spec/UML/2.5/PDF/
The first one, for instance has an example for generating JavaBeans
containing the following code snippet
[template public generate(aClass : Class)]
[file (aClass.name.concat('.java'), false)]
public class [aClass.name.toUpperFirst()/] {
[for...
So I know at least, that there has to be some Object or Type named 'Class', which has to have an attribute 'name', which is itself an object with an operation 'toupperFirst()'.
I looked for 'toupperFirst' in the above documents, found it in the second but not in the third one.
But, I neither found the keywords 'stereotype' nor 'package' in the second one
(package is in there, but not as a metaclass but only somewhere within XML-Code).
When I look at the JavaDoc provided by Christian W. Damus
http://download.eclipse.org/modeling/mdt/uml2/javadoc/5.0.0/
The UML metaclass 'Class' has a method called ''getName()" as Ed Willink pointed out,
which returns a 'java.lang.String', which then doesn't have a method "toupperFirst()".
So I wonder if all those really are the right places to look for a documentation.
Best regards
Philip.
P.s. It seems to me that XTend is for generating Java Source code, while I want Java, C++, Gradle, CMake code.
[Updated on: Tue, 28 February 2017 12:05] by Moderator
|
|
| |
Re: UML2 MOFM2T API DOC? [message #1755195 is a reply to message #1755172] |
Tue, 28 February 2017 17:59   |
Eclipse User |
|
|
|
Hello once again,
I have looked into XTend,
but I guess, I will stay with Acceleo for the time being.
The WYSIWYG nature seems to make it way more easier atm.
XTend looks like you need to invest considerably more time into learning the basics.
Anyway, I will for sure keep it in mind, and maybe try it out later.
Concerning my question, now that I realized, with your help, that the functions are those of Acceleo/MOFM2T together with those of the Metamodel (in my case UML 2.5),
I guess, I will be able to figure out the rest on my own
using the 3 documents that I posted in my last post in addition with the Acceleo help.
Thank you guys.
|
|
| |
Re: UML2 MOFM2T API DOC? [message #1755229 is a reply to message #1755215] |
Wed, 01 March 2017 05:56   |
Eclipse User |
|
|
|
Hello Ed,
thank you for clarifying.
It really looks promising,
but I don't understand, where the <<expression>> syntax comes from,
looks like EBNF to me.
In the XTend documentation
https://www.eclipse.org/xtend/documentation/204_activeannotations.html
it is suddenly used when it comes to "Phase 4: Code Generation" but never introduced.
Clearly in your example this is the part where the Java++ resides, and the rest seems to be literal text, starting within the writer.append; I guess the ''' do initiate some literal text block and somehow the << >> make an exception or something like that, but what are they,
are those the in-memory elements, that the next section "On Expressions and Statements" talks about?
I have never seen that syntax until now, I am more a C++ developer though, and my Java knoweldge is somewhat outdated.
Thank you for your time and trouble.
Best
Philip.
|
|
| |
Re: UML2 MOFM2T API DOC? [message #1755234 is a reply to message #1755230] |
Wed, 01 March 2017 06:17  |
Eclipse User |
|
|
|
Hi
A template language has a major design challenge, how do you escape from the literal text into control text?
MOFM2T (and consequently Acceleo) made the obvious decision and stuck with the 96 ASCII characters, and so chose [.../] as control text escaping. This is a pain whenever you want to use a [ in your literal text. [.../] lacks readability IMHO.
Xtend, or rather its Xpand predecessor made the radical decision to move on from ASCII 96 and use guillemets as control text escaping. Now it is only a pain if you also want guillemets in your literal text; never happens to me. More commonly the guillemets are corrupted by inconsistent character encoding preferences (set all projects explicitly to UTF-8, Linux newlines). Guillemets are much more readable IMHO, but unfortunately they are a pain to type in arbitrary tools. I often resort to cut and paste. The triple quote is indeed the outer escape from Java text into template text.
Regards
Ed Willink
|
|
|
Goto Forum:
Current Time: Fri Apr 18 23:03:15 EDT 2025
Powered by FUDForum. Page generated in 0.14100 seconds
|