Class EagerTagDecorator<T extends Tag>
- java.lang.Object
-
- com.hubspot.jinjava.lib.tag.eager.EagerTagDecorator<T>
-
- All Implemented Interfaces:
Importable
,Tag
,Serializable
- Direct Known Subclasses:
EagerForTag
,EagerGenericTag
,EagerIfTag
,EagerIncludeTag
,EagerStateChangingTag
@Beta public abstract class EagerTagDecorator<T extends Tag> extends Object implements Tag
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description EagerTagDecorator(T tag)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TagToken
buildToken(TagNode tagNode, InterpretException e, int deferredLineNumber, int deferredPosition)
String
eagerInterpret(TagNode tagNode, JinjavaInterpreter interpreter, InterpretException e)
Return the string value of interpreting this tag node knowing that a deferred value has been encountered.String
getEagerImage(Token token, JinjavaInterpreter interpreter)
Casts token to TagToken if possible to get the eager image of the token.String
getEagerTagImage(TagToken tagToken, JinjavaInterpreter interpreter)
Uses theEagerExpressionResolver
to partially evaluate any expression within the tagToken's helpers.String
getEndTagName()
String
getName()
T
getTag()
protected String
innerInterpret(TagNode tagNode, JinjavaInterpreter interpreter)
String
interpret(TagNode tagNode, JinjavaInterpreter interpreter)
boolean
isRenderedInValidationMode()
String
renderChildren(TagNode tagNode, JinjavaInterpreter interpreter)
Render all children of this TagNode.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.hubspot.jinjava.lib.tag.Tag
interpretOutput
-
-
-
-
Constructor Detail
-
EagerTagDecorator
public EagerTagDecorator(T tag)
-
-
Method Detail
-
getTag
public T getTag()
-
interpret
public final String interpret(TagNode tagNode, JinjavaInterpreter interpreter)
-
innerInterpret
protected String innerInterpret(TagNode tagNode, JinjavaInterpreter interpreter)
-
getName
public String getName()
- Specified by:
getName
in interfaceImportable
-
getEndTagName
public String getEndTagName()
- Specified by:
getEndTagName
in interfaceTag
- Returns:
- Get name of end tag (lowerCase). Null if it's a single tag without content.
-
isRenderedInValidationMode
public boolean isRenderedInValidationMode()
- Specified by:
isRenderedInValidationMode
in interfaceTag
-
eagerInterpret
public String eagerInterpret(TagNode tagNode, JinjavaInterpreter interpreter, InterpretException e)
Return the string value of interpreting this tag node knowing that a deferred value has been encountered. The tag node can not simply get evaluated normally in this circumstance.- Parameters:
tagNode
- TagNode to interpret.interpreter
- The JinjavaInterpreter.e
- The exception that required non-default interpretation. May be null- Returns:
- The string result of performing an eager interpretation of the TagNode
-
buildToken
public TagToken buildToken(TagNode tagNode, InterpretException e, int deferredLineNumber, int deferredPosition)
-
renderChildren
public String renderChildren(TagNode tagNode, JinjavaInterpreter interpreter)
Render all children of this TagNode.- Parameters:
tagNode
- TagNode to render the children of.interpreter
- The JinjavaInterpreter.- Returns:
- the string output of this tag node's children.
-
getEagerImage
public final String getEagerImage(Token token, JinjavaInterpreter interpreter)
Casts token to TagToken if possible to get the eager image of the token.- Parameters:
token
- Token to cast.interpreter
- The Jinjava interpreter.- Returns:
- The image of the token which has been evaluated as much as possible.
- See Also:
getEagerTagImage(TagToken, JinjavaInterpreter)
-
getEagerTagImage
public String getEagerTagImage(TagToken tagToken, JinjavaInterpreter interpreter)
Uses theEagerExpressionResolver
to partially evaluate any expression within the tagToken's helpers. If there are any macro functions that must be deferred, then their images are pre-pended to the result, which is the partial image of theTagToken
.- Parameters:
tagToken
- TagToken to get the eager image of.interpreter
- The Jinjava interpreter.- Returns:
- A new image of the tagToken, which may have expressions that are further
resolved than in the original
Token.getImage()
.
-
-