Package com.github.mustachejava.codes
Class DefaultCode
- java.lang.Object
-
- com.github.mustachejava.codes.DefaultCode
-
- All Implemented Interfaces:
Code,java.lang.Cloneable
- Direct Known Subclasses:
CommentCode,DefaultMustache,ExtendCheckNameCode,ExtendNameCode,IterableCode,PartialCode,ValueCode,WriteCode
public class DefaultCode extends java.lang.Object implements Code, java.lang.Cloneable
Simplest possible code implementaion with some default shared behavior
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.Stringappendedprivate char[]appendedCharsprotected Bindingbindingprotected DefaultMustacheFactorydfprotected Mustachemustacheprotected java.lang.Stringnameprotected ObjectHandlerohprotected booleanreturnThisprotected TemplateContexttcprotected java.lang.Stringtype
-
Constructor Summary
Constructors Constructor Description DefaultCode()DefaultCode(TemplateContext tc, DefaultMustacheFactory df, Mustache mustache, java.lang.String name, java.lang.String type)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleanaddScope(java.util.List<java.lang.Object> scopes, java.lang.Object scope)voidappend(java.lang.String text)protected java.io.WriterappendText(java.io.Writer writer)java.lang.Objectclone()java.lang.Objectclone(java.util.Set<Code> seen)java.io.Writerexecute(java.io.Writer writer, java.util.List<java.lang.Object> scopes)The default behavior is to run the codes and append the captured text.protected voidfilterText()java.lang.Objectget(java.util.List<java.lang.Object> scopes)Code[]getCodes()java.lang.StringgetName()voididentity(java.io.Writer writer)voidinit()Nodeinvert(Node node, java.lang.String text, java.util.concurrent.atomic.AtomicInteger position)protected NodematchAppended(Node node, java.lang.String text, java.util.concurrent.atomic.AtomicInteger position, int start)protected java.io.Writerrun(java.io.Writer writer, java.util.List<java.lang.Object> scopes)protected voidrunIdentity(java.io.Writer writer)voidsetCodes(Code[] newcodes)protected voidtag(java.io.Writer writer, java.lang.String tag)
-
-
-
Field Detail
-
appended
protected java.lang.String appended
-
mustache
protected Mustache mustache
-
oh
protected final ObjectHandler oh
-
name
protected final java.lang.String name
-
tc
protected final TemplateContext tc
-
type
protected final java.lang.String type
-
returnThis
protected final boolean returnThis
-
binding
protected final Binding binding
-
df
protected final DefaultMustacheFactory df
-
appendedChars
private char[] appendedChars
-
-
Constructor Detail
-
DefaultCode
public DefaultCode()
-
DefaultCode
public DefaultCode(TemplateContext tc, DefaultMustacheFactory df, Mustache mustache, java.lang.String name, java.lang.String type)
-
-
Method Detail
-
clone
public java.lang.Object clone()
-
clone
public java.lang.Object clone(java.util.Set<Code> seen)
-
invert
public Node invert(Node node, java.lang.String text, java.util.concurrent.atomic.AtomicInteger position)
-
matchAppended
protected Node matchAppended(Node node, java.lang.String text, java.util.concurrent.atomic.AtomicInteger position, int start)
-
filterText
protected void filterText()
-
get
public java.lang.Object get(java.util.List<java.lang.Object> scopes)
-
execute
public java.io.Writer execute(java.io.Writer writer, java.util.List<java.lang.Object> scopes)The default behavior is to run the codes and append the captured text.
-
runIdentity
protected void runIdentity(java.io.Writer writer)
-
tag
protected void tag(java.io.Writer writer, java.lang.String tag) throws java.io.IOException- Throws:
java.io.IOException
-
appendText
protected java.io.Writer appendText(java.io.Writer writer)
-
run
protected java.io.Writer run(java.io.Writer writer, java.util.List<java.lang.Object> scopes)
-
addScope
protected boolean addScope(java.util.List<java.lang.Object> scopes, java.lang.Object scope)
-
-