Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'doc/org.eclipse.jet.doc/references/syntax/jetSyntaxDeclarations.xhtml')
-rw-r--r--doc/org.eclipse.jet.doc/references/syntax/jetSyntaxDeclarations.xhtml63
1 files changed, 63 insertions, 0 deletions
diff --git a/doc/org.eclipse.jet.doc/references/syntax/jetSyntaxDeclarations.xhtml b/doc/org.eclipse.jet.doc/references/syntax/jetSyntaxDeclarations.xhtml
new file mode 100644
index 0000000..7b252df
--- /dev/null
+++ b/doc/org.eclipse.jet.doc/references/syntax/jetSyntaxDeclarations.xhtml
@@ -0,0 +1,63 @@
+<?xml version='1.0'?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html>
+
+ <head>
+
+ <title>JET Java Declaration Syntax Reference</title>
+
+ <link charset="ISO-8859-1" href="../../book.css" rel="STYLESHEET"
+ type="text/css"/>
+
+ </head>
+
+ <body>
+
+ <h2>JET Java Declaration Syntax Reference</h2>
+
+ <p>JET templates may declare Java methods or fields by enclosing it
+ within the characters <code>&lt;%!</code> and <code>%&gt;</code>.
+ </p>
+
+ <h3>Valid Declarations</h3>
+
+ <p>Each declaration may contain one or more syntactically correct
+ Java method or field declarations. The following are examples of
+ valid declarations:</p>
+
+ <pre>&lt;%!
+/**
+ * Say hello the the addressee passed to the method
+ */
+public String hello(String addressee) {
+ return &quot;Hello &quot; + addresseee + &quot;!&quot;;
+}
+%&gt;
+
+&lt;%!
+// Declarations may contain multiple Java declarations
+private int min(int a, int b) {
+ return Math.min(a, b);
+}
+
+private int max(int a, int b) {
+ return Math.max(a, b);
+}
+%&gt;</pre>
+ <h3>Invalid Declarations</h3>
+
+ <p>If a declaration contains an syntax error, the generated Java
+ code for the containing template will have a syntax error. The JET
+ compile does not attempt to correlate the Java compile error back
+ to the JET template.</p>
+
+ <h3>Escaping Declaration characters</h3>
+
+ <p>To emit the characters <code>&lt;%!</code> in a templates
+ output, enter <code>&lt;\%!</code>. To emit <code>%&gt;</code>,
+ enter <code>%\&gt;</code>.</p>
+
+ </body>
+
+</html>
+

Back to the top