Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » EGL/EOL java code
EGL/EOL java code [message #885946] Wed, 13 June 2012 23:01 Go to next message
Arnaldo Caprai is currently offline Arnaldo CapraiFriend
Messages: 17
Registered: April 2012
Junior Member
Hi All,

Can some please pass me any small example (or link to) of generating Java code from the domain models using EGL/EOL.

Regards,
Arnaldo
Re: EGL/EOL java code [message #886072 is a reply to message #885946] Thu, 14 June 2012 07:34 Go to previous messageGo to next message
Antonio Garcia-Dominguez is currently offline Antonio Garcia-DominguezFriend
Messages: 594
Registered: January 2010
Location: Birmingham, UK
Senior Member

Hi Arnaldo,

I'm not sure which domain models you're referring to :-/.

Regardless, here's an example for using EGL to generate HTML code from a model. Generating Java code is pretty much the same, except you might want to register an appropriate formatter:

http://www.eclipse.org/epsilon/examples/index.php?example=org.eclipse.epsilon.examples.egldoc

Did that help?

Regards,
Antonio
Re: EGL/EOL java code [message #886094 is a reply to message #886072] Thu, 14 June 2012 08:27 Go to previous messageGo to next message
Arnaldo Caprai is currently offline Arnaldo CapraiFriend
Messages: 17
Registered: April 2012
Junior Member
Hi Antonio

Thanks, but I am referring to XMI based models drawn on EMF/GMF editor, as processing of generating code from domain specific modeling language.

Also, how to of register an appropriate formatter such for JAVA.

Any guide would help a lot.

Arnaldo


Re: EGL/EOL java code [message #886661 is a reply to message #886072] Fri, 15 June 2012 11:36 Go to previous messageGo to next message
Arnaldo Caprai is currently offline Arnaldo CapraiFriend
Messages: 17
Registered: April 2012
Junior Member
Hi,

I have found some example on the use of formatter to genarate EGL template based Java code

[%
 var f = new Native("org.eclipse.epsilon.egl.formatter.language.JavaFormatter");
 var t = TemplateFactory.load("generate_some_java.egl");
 t.setFormatter(f);
 t.generate("formatted.java");
 %]


However, would it be possible to have look at some EGL template and generated Java code, to understand better on its use. This would help including me all the newcomers to utilize EOL/EGL for model-to-text transformation.

Regards,
Arnaldo
Re: EGL/EOL java code [message #890159 is a reply to message #886661] Thu, 21 June 2012 10:10 Go to previous messageGo to next message
Arnaldo Caprai is currently offline Arnaldo CapraiFriend
Messages: 17
Registered: April 2012
Junior Member
Hi All,

Can someone please provide me with an example/snippet of EGL template, specified for generating Java code.
Arnaldo
Re: EGL/EOL java code [message #890236 is a reply to message #890159] Thu, 21 June 2012 14:40 Go to previous messageGo to next message
Maarten Bezemer is currently offline Maarten BezemerFriend
Messages: 117
Registered: February 2012
Senior Member
Any EGL template is sufficient:
[%
  var className = "MyClass";
%]
/**
 * Header of [%= className %]
 */

class [%= className %] {
  // Add methods
}


This might be a bit boring as it just generates an empty class (with a static name), so you'd need to expand it with more useful stuff.

[Updated on: Thu, 21 June 2012 14:40]

Report message to a moderator

Re: EGL/EOL java code [message #890466 is a reply to message #890236] Fri, 22 June 2012 11:13 Go to previous message
Arnaldo Caprai is currently offline Arnaldo CapraiFriend
Messages: 17
Registered: April 2012
Junior Member
Thanks Maarten
Previous Topic:Strange Model Artifacts
Next Topic:EVL validation fixes are not usable when having multiple EVL files
Goto Forum:
  


Current Time: Fri Mar 29 10:20:14 GMT 2024

Powered by FUDForum. Page generated in 0.02199 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top