public class JSTemplateCompiler extends Object
| Constructor and Description |
|---|
JSTemplateCompiler() |
| Modifier and Type | Method and Description |
|---|---|
void |
addLibrary(Class<?> resourceClass,
String name) |
void |
addLibrary(File input) |
void |
addLibrary(String identifier,
String sourceCode) |
JSTemplate |
compile(Class<?> clz,
String resource,
String encoding)
Get a class resource as a template and compile it.
|
JSTemplate |
compile(Reader input,
String sourceName)
Create a template from input.
|
protected void |
error(String string) |
Object |
execute(Appendable res,
Class<?> clz,
String resource,
Object... assignments) |
void |
execute(Appendable res,
Reader input,
String sourceName,
Object... assignments)
Compile, then execute the specified template once.
|
void |
execute(IJSTemplateContext tc,
Reader input,
String sourceName,
Map<String,Object> assignments) |
void |
execute(IJSTemplateContext tc,
Reader input,
String sourceName,
Object... assignments)
Compile, then execute the specified template once.
|
Object |
executeMap(Appendable res,
Class<?> clz,
String resource,
Map<String,Object> assignments) |
void |
executeMap(Appendable tc,
Reader input,
String sourceName,
Map<String,Object> assignments) |
String |
getTranslation() |
static int[] |
remapLocation(List<JSLocationMapping> mapList,
int lineNumber,
int columnNumber)
Walk the remap list, and try to calculate a source location for a given output location.
|
static void |
strToJavascriptString(StringBuilder w,
CharSequence cs,
boolean dblquote) |
protected void |
translate(Reader input)
Translate input to a Javascript program.
|
public void addLibrary(Class<?> resourceClass, String name) throws Exception
Exception@Nonnull public JSTemplate compile(Reader input, String sourceName) throws Exception
input - Exceptionpublic String getTranslation()
@Nonnull public JSTemplate compile(@Nonnull Class<?> clz, @Nonnull String resource, @Nullable String encoding) throws Exception
clz - resource - encoding - Exceptionpublic void execute(Appendable res, Reader input, String sourceName, Object... assignments) throws Exception
res - input - sourceName - Exceptionpublic void execute(IJSTemplateContext tc, Reader input, String sourceName, Object... assignments) throws Exception
tc - input - sourceName - assignments - Exceptionpublic Object execute(Appendable res, Class<?> clz, String resource, Object... assignments) throws Exception
Exceptionpublic void execute(IJSTemplateContext tc, Reader input, String sourceName, Map<String,Object> assignments) throws Exception
Exceptionpublic void executeMap(Appendable tc, Reader input, String sourceName, Map<String,Object> assignments) throws Exception
Exceptionpublic Object executeMap(Appendable res, Class<?> clz, String resource, Map<String,Object> assignments) throws Exception
Exceptionpublic static int[] remapLocation(List<JSLocationMapping> mapList, int lineNumber, int columnNumber)
mapList - lineNumber - columnNumber - protected void translate(Reader input) throws Exception
input - Exceptionpublic static void strToJavascriptString(StringBuilder w, CharSequence cs, boolean dblquote)
protected void error(String string)
Copyright © 2017 etc.to. All rights reserved.