Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » Generating jet1 implementation classes with jet2
Generating jet1 implementation classes with jet2 [message #59985] Mon, 27 April 2009 14:21 Go to next message
Eclipse UserFriend
Originally posted by: neko.ticino.com

Hi,

I'm using jet1 to generate java files, now I'm trying jet2 but it does
not generate the implementation classes like in jet1.

This implementation class is taken from an example from the tutorial:

public class TranslationDemoTemplate
{
protected final String NL = System.getProperties().getProperty("line.separator");
protected final String TEXT_1 = "Hello, ";
protected final String TEXT_2 = "!";

public String generate(Object argument)
{
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append(TEXT_1);
stringBuffer.append(argument);
stringBuffer.append(TEXT_2);

stringBuffer.append("Hello again!");
return stringBuffer.toString();
}
}

In jet1 there were skeleton files to modify the java output, now if I
want to have this kind of output in jet2 (a java file with the generate
method), do I have to write a template my own or there is another way
to have this result?

Thank you!

Alex
Re: Generating jet1 implementation classes with jet2 [message #60251 is a reply to message #59985] Thu, 30 April 2009 15:21 Go to previous message
Paul Elder is currently offline Paul ElderFriend
Messages: 849
Registered: July 2009
Senior Member
Alex Nekoti wrote:

> I'm using jet1 to generate java files, now I'm trying jet2 but it does
> not generate the implementation classes like in jet1.

snip

> In jet1 there were skeleton files to modify the java output, now if I
> want to have this kind of output in jet2 (a java file with the generate
> method), do I have to write a template my own or there is another way
> to have this result?

JET2 doesn't have the equivalent of a skeleton file. But there are
alternatives:

1) JET2 templates support embedded members to the generated class via the
<%! ... %> markup:
<%!
// declare a class field
private int foo;

// declare a method
private int getFoo() {
return foo;
}
%>

2) You can get have file and class comments inserted into the generated
java file by using special keywords in JET comments:
<%-- @class
This a Javadoc comment for the class
--%>
<%-- @header
This a comment that will appear as the header comment on the .java file. It
is a suitable place to put Java doc
--%>

Paul
Previous Topic:[Acceleo] Text to Model
Next Topic:Need help on JET + JMerge custom code regeneration
Goto Forum:
  


Current Time: Fri Apr 26 17:26:10 GMT 2024

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

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

Back to the top