<java:class>

Standard JET2 Java Tags

class

Create a Java class with the specified name and write its contents by evaluating the supplied template.


Tag Summary
required <java:class name="value" template="value"/>
full tag <java:class name="value" template="value" package="value" srcFolder="value" replace="value" encoding="value" derived="value"/>

Required Attributes
name
The name unqualified name of the Java class.
template
A project-relative path of a JET template to execute. The template provides the class file's contents.

Optional Attributes
package
The name of the java package. If not specified, then the name of the containing 'java:package' tag is used, otherwise, the default package is used.
srcFolder
The a path of source folder. If a relative path, this relative to any containing 'ws:project' or 'ws:folder' tags. If absolute, it is treated as a workspace relative path. If omitted, the first source folder of the containing project is used.
replace
A boolean ('true' or 'false') value. If 'true', the tag will overwrite an existing file, otherwise it will not. If omitted, a value of 'true' is assumed.
encoding
The character encoding of the file. If omitted, then the Eclipse workspace determines the encoding. If provided, then the encoding is changed to the specified value. A value of '#default' restores the encoding of the file to the workspace determined default.
derived
A boolean value ('true' or 'false') determining the value of the workspace 'derived' attribute for the file. If omitted, a value of 'false' is assumed.

Example
<%-- create class Foo in package org.example in source folder myProject/src --%<
<java:class name="Foo" package="org.example" srcFolder="myProject/src" template="myJava.jet"/>

<%-- create classes Foo & Bar in package org.example in source folder myProject/src --%>
<ws:project name="myProject">
  <ws:folder path="src">
    <java:package name="org.example">
      <java:class name="Foo" template="myFoo.jet"/>
      <java:class name="Bar" template="myBar.jet"/>
    </java:package>
  </ws:folder>
</ws:project>