public class CodeBuilder extends TextBuilder
| Modifier and Type | Class and Description |
|---|---|
static class |
CodeBuilder.InlineClass |
static class |
CodeBuilder.InlineTag |
static class |
CodeBuilder.RenderArgDeclaration |
TextBuilder.StrBuf| Modifier and Type | Field and Description |
|---|---|
String |
buildBody |
Set<String> |
imports |
String |
includingCName |
static String |
INTERRUPT_CODE |
protected static ILogger |
logger |
protected boolean |
logTime |
boolean |
removeNextLF |
Map<String,CodeBuilder.RenderArgDeclaration> |
renderArgs |
IDialect |
requiredDialect |
ICodeType |
templateDefLang |
protected String |
tmpl |
__buffer, __caller| Constructor and Description |
|---|
CodeBuilder() |
CodeBuilder(String template,
String className,
String tagName,
org.rythmengine.internal.compiler.TemplateClass templateClass,
RythmEngine engine,
IDialect requiredDialect)
create the given CodeBuilder
|
| Modifier and Type | Method and Description |
|---|---|
void |
addBuilder(Token builder) |
void |
addImport(String imprt,
int lineNo)
add the given import
|
String |
addInclude(String include,
int lineNo,
ICodeType codeType)
add include
|
String |
addIncludes(String includes,
int lineNo,
ICodeType codeType) |
String |
addInlineInclude(String inlineTemplate,
int lineNo) |
void |
addRenderArgs(CodeBuilder.RenderArgDeclaration declaration) |
void |
addRenderArgs(int lineNo,
String type,
String name) |
void |
addRenderArgs(int lineNo,
String type,
String name,
String defVal) |
void |
addRenderArgsIfNotDeclared(int lineNo,
String type,
String name) |
void |
addStaticCode(String codeSnippet) |
boolean |
basicTemplate() |
TextBuilder |
build()
Sub class could implement this method to append the generated
source code to the buffer
|
String |
className() |
void |
clear()
Reset to the state before construction
|
CodeBuilder.InlineClass |
defClass(String className,
String body) |
CodeBuilder.InlineTag |
defTag(String tagName,
String retType,
String signature,
String body) |
void |
endTag(CodeBuilder.InlineTag tag) |
RythmEngine |
engine() |
protected String |
extended() |
org.rythmengine.internal.compiler.TemplateClass |
getExtendedTemplateClass() |
List<Token> |
getMacro(String macro) |
String |
getRenderArgType(String name) |
org.rythmengine.internal.compiler.TemplateClass |
getTemplateClass() |
boolean |
hasInlineTagWithoutArgument(String tagName) |
boolean |
hasMacro(String macro) |
String |
includingClassName() |
boolean |
isLastBuilderLiteral() |
boolean |
isRythmTemplate() |
boolean |
lastIsBlockToken() |
void |
merge(CodeBuilder codeBuilder) |
boolean |
needsPrint(String tagName) |
String |
newVarName() |
protected void |
pBuild() |
protected void |
pClassClose() |
protected void |
pClassOpen() |
protected void |
pExtendInitArgCode() |
protected void |
pFinalCode() |
protected void |
pImports() |
protected void |
pInitCode() |
protected void |
pInlineClasses() |
protected void |
pInlineTags() |
void |
popMacro() |
protected void |
pPackage() |
protected void |
pRenderArgs() |
static String |
preventInfiniteLoop(String code) |
protected void |
pSetup() |
protected void |
pStaticCodes() |
protected void |
pTagImpl() |
void |
pushMacro(String macro) |
void |
removeSpaceTillLastLineBreak(IContext ctx)
If from the current cursor till last linebreak are all space, then
remove all those spaces and the last line break
|
void |
removeSpaceToLastLineBreak(IContext ctx)
If from the current cursor to last linebreak are all space, then
remove all those spaces and the last line break
|
void |
rewind()
Rewind to the state when construction finished
|
void |
setExtended_deprecated(String extended,
org.rythmengine.internal.parser.build_in.InvokeTemplateParser.ParameterDeclarationList args,
int lineNo) |
void |
setExtended(Class<? extends TemplateBase> c) |
void |
setExtended(String extended,
org.rythmengine.internal.parser.build_in.InvokeTemplateParser.ParameterDeclarationList args,
int lineNo) |
void |
setFinalCode(String code) |
void |
setInitCode(String code) |
void |
setLogTime() |
__append, __append, __append, __append, __append, __append, __append, __append, __append, __getBuffer, __setBuffer, buffer, caller, clone, getSelfOut, np, p, p, p, p, p, p, p, p, p, p2t, p2tn, p3t, p3tn, p4t, p4tn, pn, pn, pt, ptn, setSelfOut, toStringprotected static final ILogger logger
public ICodeType templateDefLang
protected String tmpl
public String includingCName
public Map<String,CodeBuilder.RenderArgDeclaration> renderArgs
public transient IDialect requiredDialect
protected boolean logTime
public boolean removeNextLF
public String buildBody
public static final String INTERRUPT_CODE
public CodeBuilder(String template, String className, String tagName, org.rythmengine.internal.compiler.TemplateClass templateClass, RythmEngine engine, IDialect requiredDialect)
template - className - tagName - templateClass - engine - requiredDialect - public CodeBuilder()
public RythmEngine engine()
public boolean isRythmTemplate()
public void setInitCode(String code)
public void setFinalCode(String code)
protected String extended()
public org.rythmengine.internal.compiler.TemplateClass getExtendedTemplateClass()
public boolean isLastBuilderLiteral()
public org.rythmengine.internal.compiler.TemplateClass getTemplateClass()
public boolean basicTemplate()
public void clear()
public void rewind()
public void merge(CodeBuilder codeBuilder)
public String className()
public String includingClassName()
public void addImport(String imprt, int lineNo)
imprt - lineNo - public boolean hasInlineTagWithoutArgument(String tagName)
public boolean needsPrint(String tagName)
public void addStaticCode(String codeSnippet)
public CodeBuilder.InlineClass defClass(String className, String body)
public CodeBuilder.InlineTag defTag(String tagName, String retType, String signature, String body)
public void endTag(CodeBuilder.InlineTag tag)
public String addInclude(String include, int lineNo, ICodeType codeType)
include - lineNo - codeType - public void setExtended(Class<? extends TemplateBase> c)
public void setExtended(String extended, org.rythmengine.internal.parser.build_in.InvokeTemplateParser.ParameterDeclarationList args, int lineNo)
public void setExtended_deprecated(String extended, org.rythmengine.internal.parser.build_in.InvokeTemplateParser.ParameterDeclarationList args, int lineNo)
public void setLogTime()
public void addRenderArgs(CodeBuilder.RenderArgDeclaration declaration)
public void addRenderArgsIfNotDeclared(int lineNo,
String type,
String name)
public void pushMacro(String macro)
public void popMacro()
public boolean hasMacro(String macro)
public boolean lastIsBlockToken()
public void addBuilder(Token builder)
public void removeSpaceToLastLineBreak(IContext ctx)
public void removeSpaceTillLastLineBreak(IContext ctx)
public TextBuilder build()
TextBuilderbuild in class TextBuilderprotected void pPackage()
protected void pImports()
protected void pClassOpen()
protected void pClassClose()
protected void pRenderArgs()
protected void pExtendInitArgCode()
protected void pSetup()
protected void pInitCode()
protected void pFinalCode()
protected void pTagImpl()
protected void pInlineTags()
protected void pStaticCodes()
protected void pInlineClasses()
protected void pBuild()
public String newVarName()
Copyright 2013-2016, The Rythm Engine project