Go home

Simple Template

Note @__simple__ template cannot extend other template, neither does it has implicit arguments and imports. But it's slightly faster and memory efficient than normal templates.

See the Java source generated below, and compare to the java source code generated from other normal templates.

Template Source

@__simple__

<p>
    <a href="/">Go home</a>
</p>

<h1>Simple Template</h1>

<p>
    Note <code>@@__simple__</code> template cannot extend other template, neither does it has implicit arguments and imports. But it's slightly faster and memory efficient than normal templates.
</p>
<p>
    See the Java source generated below, and compare to the java source code generated from other normal templates.
</p>

@{
    String javaSrc = getTemplateClass(false).javaSource;
    String tmplSrc = getTemplateClass(false).getTemplateSource()
}

<h3>Template Source</h3>
<pre>
@tmplSrc
</pre>

<h3>Java Source</h3>
<pre>
@javaSrc
</pre>

Java Source

import play.templates.JavaExtensions;
import controllers.*;
import models.*;
import java.util.*;
import java.io.*;

public class app_rythm_Demo_testSimple_html__R_T_C__ extends com.greenlaw110.rythm.template.TagBase {

	@Override public java.lang.String getName() {
		return "Demo.testSimple";
	}

	@Override protected void setup() {
		if (tmplSrc == null) {tmplSrc=(Object)_get("tmplSrc");}
		if (javaSrc == null) {javaSrc=(Object)_get("javaSrc");}
	}

	protected Object tmplSrc=null;
	protected Object javaSrc=null;

	@SuppressWarnings("unchecked") public void setRenderArgs(java.util.Map<String, Object> args) {
		if (null != args && args.containsKey("tmplSrc")) this.tmplSrc=(Object)args.get("tmplSrc");
		if (null != args && args.containsKey("javaSrc")) this.javaSrc=(Object)args.get("javaSrc");
		super.setRenderArgs(args);
	}

	@SuppressWarnings("unchecked") public void setRenderArgs(Object... args) {
		int _p = 0, l = args.length;
		if (_p < l) { Object v = args[_p++]; boolean isString = ("java.lang.String".equals("Object") || "String".equals("Object")); tmplSrc = (Object)(isString ? (null == v ? "" : v.toString()) : v); }
		if (_p < l) { Object v = args[_p++]; boolean isString = ("java.lang.String".equals("Object") || "String".equals("Object")); javaSrc = (Object)(isString ? (null == v ? "" : v.toString()) : v); }
	}

	@SuppressWarnings("unchecked") @Override public void setRenderArg(String name, Object arg) {
		if ("tmplSrc".equals(name)) this.tmplSrc=(Object)arg;
		if ("javaSrc".equals(name)) this.javaSrc=(Object)arg;
		super.setRenderArg(name, arg);
	}

	@SuppressWarnings("unchecked") public void setRenderArg(int pos, Object arg) {
		int _p = 0;
		if (_p++ == pos) { Object v = arg; boolean isString = ("java.lang.String".equals("Object") || "String".equals("Object")); tmplSrc = (Object)(isString ? (null == v ? "" : v.toString()) : v); }
		if (_p++ == pos) { Object v = arg; boolean isString = ("java.lang.String".equals("Object") || "String".equals("Object")); javaSrc = (Object)(isString ? (null == v ? "" : v.toString()) : v); }
		if(0 == pos) setRenderArg("arg", arg);
	}



    protected String _msg(String key, Object ... params) {return play.i18n.Messages.get(key, params);}
    protected String _url(String action, Object... params) {return _url(false, action, params);}
   protected String _url(boolean isAbsolute, String action, Object... params) {
       com.greenlaw110.rythm.internal.compiler.TemplateClass tc = getTemplateClass(true);
       boolean escapeXML = (!tc.isStringTemplate() && tc.templateResource.getKey().toString().endsWith(".xml"));
       return new com.greenlaw110.rythm.play.utils.ActionBridge(isAbsolute, escapeXML).invokeMethod(action, params).toString();
   }


	@Override public com.greenlaw110.rythm.utils.TextBuilder build(){
		out().ensureCapacity(653);
 //line: 3
p("<p>\n    <a href=\"/\">Go home</a>\n</p>\n\n<h1>Simple Template</h1>\n\n<p>\n    Note <code>"); //line: 10
p("@__simple__</code> template cannot extend other template, neither does it has implicit arguments and imports. But it's slightly faster and memory efficient than normal templates.\n</p>\n<p>\n    See the Java source generated below, and compare to the java source code generated from other normal templates.\n</p>\n\n"); //line: 16
 //line: 16
    String javaSrc = getTemplateClass(false).javaSource; //line: 17
    String tmplSrc = getTemplateClass(false).getTemplateSource() //line: 18
; //line: 21
p("<h3>Template Source</h3>\n<pre>\n"); //line: 23

try{pe(tmplSrc);} catch (RuntimeException e) {handleTemplateExecutionException(e);}  //line: 23
p("\n</pre>\n\n<h3>Java Source</h3>\n<pre>\n"); //line: 28

try{pe(javaSrc);} catch (RuntimeException e) {handleTemplateExecutionException(e);}  //line: 28
p("\n</pre>"); //line: 29

		return this;
	}

}