Top Description Fields Constructors Methods
com.google.escapevelocity

pack-priv Class ParseNode

extends Node
Class Inheritance
Imports
com.google.escapevelocity.Template.ResourceOpener, java.io.IOException, java.util.Map

Representation of a #parse directive in the parse tree.

A #parse (<primary>) directive does nothing until the template is evaluated. Then the <primary> should evaluate to a string, which will be used to derive a nested Template. If the string was seen before (in this evaluation, or an earlier evaluation) then the Template will be retrieved from the parseCache. Otherwise we will get a Reader from the ResourceOpener and parse its contents to produce a new Template, which we will record in the parseCache. Either way, we will execute the nested Template, which means adding its macros to the EvaluationContext and evaluating it to add text to the final output.

Field Summary

Modifier and TypeField and Description
private final ExpressionNode
private final Map<String, Template>
private final Template.ResourceOpener
Inherited from com.google.escapevelocity.Node:
lineNumberresourceName

Constructor Summary

AccessConstructor and Description
pack-priv
ParseNode(String resourceName, int startLine, ExpressionNode nestedResourceNameExpression, Template.ResourceOpener resourceOpener, Map<String, Template> parseCache)

Method Summary

Modifier and TypeMethod and Description
pack-priv void
render(EvaluationContext context, StringBuilder output)

Implements abstract com.google.escapevelocity.Node.render.

Adds this node's contribution to the output.
Inherited from com.google.escapevelocity.Node:
consemptyNodeevaluationExceptionevaluationExceptionisHorizontalWhitespace

Field Detail

nestedResourceNameExpressionback to summary
private final ExpressionNode nestedResourceNameExpression
parseCacheback to summary
private final Map<String, Template> parseCache
resourceOpenerback to summary
private final Template.ResourceOpener resourceOpener

Constructor Detail

ParseNodeback to summary
pack-priv ParseNode(String resourceName, int startLine, ExpressionNode nestedResourceNameExpression, Template.ResourceOpener resourceOpener, Map<String, Template> parseCache)

Method Detail

renderback to summary
pack-priv void render(EvaluationContext context, StringBuilder output)

Implements abstract com.google.escapevelocity.Node.render.

Doc from com.google.escapevelocity.Node.render.

Adds this node's contribution to the output. Depending on the node type, this might be plain text from the template, or one branch of an #if, or the value of a $reference, etc.

Annotations
@Override