Skip to content

trajano/jetng

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Java Emitter Template NG

Build Status

This is a rebuild of the Java Emitter Templates project without the use of any Eclipse dependencies.

JET is a tool that can be used to generate Java code from JSP like templates much like JSPs get converted to Servlet code. Older versions of JET created code that used a simple StringBuilder and didn't have any other dependencies outside of the JDK.

This implementation adds a few extra features to the JET specification.

Sample .jet file

<%@ jet package="foo" class="Bar" %>
Hello world
<%-- comments --%>
<% Meta meta = (Meta)arguments; %>
<%= meta.getValue()%>

It emits a java file that can be used to build a string or write to a java.io.Writer. The code itself is fully commented and does not itnroduce any implicit import statement that may cause issues for template writers. It will also pass most code quality checks from SonarQube, Checkstyle, FindBugs and PMD.

Other implementations of JET

The current Eclipse implementation of JET does not work without loading up in Eclipse. There is another Maven plugin that does similar work using ANTLR, but is not in active development.

The JET2 project proposal had indicated that it will be adding Eclipse dependencies to the generated code that makes it less feasible to use outside of Eclipse.