Example template

Following in an example of a RapidJ template file:


<#-- START TEMPLATE HEADER -->
<#-- category=example -->
<#-- type=entity -->
<#-- condition=${f.cla(entity.name)}?starts_with("A") -->
<#-- version=1.0 -->
<#-- fileNameTemplate=${f.cla(entity.name)}Object.java -->
<#-- relativeOutputDirectory=src -->
<#-- relativePackage=example.hello -->
<#-- END TEMPLATE HEADER -->
/*
${copyright.format(' * ', 80)}
 */
package ${project.rootPackage}.example.hello;

public class ${f.cla(entity.name)}Object {

}

This template would produce a file for each entity in a project whose name starts with "A". Each file would contain a Java class whose name would be derived from the entity name. Files would be written out under the "src" directory to a location determined by appending the relative package "example.hello" to the base package for the project.

Related concepts

Template
Project

Related reference

Template format