public class ASTReference extends SimpleNode
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
alternateNullStringKey |
private ASTExpression |
astAlternateValue
non null Indicates that an alternate value has been provided
|
private ASTIndex |
astIndex
non null Indicates if we are setting an index reference e.g, $foo[2], which basically
means that the last syntax of the reference are brackets.
|
private boolean |
checkEmpty |
private boolean |
computableReference |
private boolean |
escaped |
private java.lang.String |
escPrefix |
private static int |
FORMAL_REFERENCE |
private java.lang.String |
identifier |
private boolean |
logOnNull |
private boolean |
lookupAlternateLiteral |
private java.lang.String |
morePrefix |
private static int |
NORMAL_REFERENCE |
private java.lang.String |
nullString |
private int |
numChildren |
private static int |
QUIET_REFERENCE |
private int |
referenceType |
private java.lang.String |
rootString |
private static int |
RUNT |
boolean |
strictEscape
Indicates if we are using modified escape behavior in strict mode.
|
boolean |
strictRef
Indicates if we are running in strict reference mode.
|
protected Info |
uberInfo |
private boolean |
warnInvalidNullReferences
Whether to trigger an event for invalid null references, that is when a value
is present in the context or parent object but is null
|
private boolean |
warnInvalidQuietReferences
Whether to trigger an event for invalid quiet references
|
private boolean |
warnInvalidTestedReferences
Whether to trigger an event for invalid tested references - as in #if($foo)
|
Constructor and Description |
---|
ASTReference(int id) |
ASTReference(Parser p,
int id) |
Modifier and Type | Method and Description |
---|---|
boolean |
evaluate(InternalContextAdapter context)
Computes boolean value of this reference
Returns the actual value of reference return type
boolean, and 'true' if value is not null
|
java.lang.Object |
execute(java.lang.Object o,
InternalContextAdapter context)
gets an Object that 'is' the value of the reference
|
private java.lang.String |
getNullString(InternalContextAdapter context)
This method helps to implement the "render literal if null" functionality.
|
private java.lang.String |
getRoot() |
java.lang.String |
getRootString()
Returns the 'root string', the reference key
|
java.lang.Object |
getRootVariableValue(InternalContextAdapter context) |
java.lang.Object |
init(InternalContextAdapter context,
java.lang.Object data) |
java.lang.Object |
jjtAccept(ParserVisitor visitor,
java.lang.Object data) |
static java.lang.String |
printClass(java.lang.Class<?> clazz)
Utility class to handle nulls when printing a class type
|
boolean |
render(InternalContextAdapter context,
java.io.Writer writer)
gets the value of the reference and outputs it to the
writer.
|
boolean |
setValue(InternalContextAdapter context,
java.lang.Object value)
Sets the value of a complex reference (something like $foo.bar)
Currently used by ASTSetReference()
|
java.lang.Object |
value(InternalContextAdapter context) |
childrenAccept, cleanupParserAndTokens, dump, dump, dump, getColumn, getFirstToken, getFirstTokenImage, getInfo, getLastToken, getLastTokenImage, getLine, getLocation, getParser, getRuntimeServices, getTemplate, getTemplateName, getType, isInvalid, jjtAddChild, jjtClose, jjtGetChild, jjtGetNumChildren, jjtGetParent, jjtOpen, jjtSetParent, literal, saveTokenImages, setFirstToken, setInfo, setInvalid, toString, toString
private static final int NORMAL_REFERENCE
private static final int FORMAL_REFERENCE
private static final int QUIET_REFERENCE
private static final int RUNT
private int referenceType
private java.lang.String nullString
private java.lang.String alternateNullStringKey
private java.lang.String rootString
private boolean escaped
private boolean computableReference
private boolean logOnNull
private boolean lookupAlternateLiteral
private java.lang.String escPrefix
private java.lang.String morePrefix
private java.lang.String identifier
private boolean checkEmpty
public boolean strictRef
private ASTIndex astIndex
private ASTExpression astAlternateValue
public boolean strictEscape
private int numChildren
private boolean warnInvalidQuietReferences
private boolean warnInvalidNullReferences
private boolean warnInvalidTestedReferences
protected Info uberInfo
public ASTReference(int id)
id
- public ASTReference(Parser p, int id)
p
- id
- public java.lang.Object jjtAccept(ParserVisitor visitor, java.lang.Object data)
jjtAccept
in interface Node
jjtAccept
in class SimpleNode
SimpleNode.jjtAccept(org.apache.velocity.runtime.parser.node.ParserVisitor, java.lang.Object)
public java.lang.Object init(InternalContextAdapter context, java.lang.Object data) throws TemplateInitException
init
in interface Node
init
in class SimpleNode
TemplateInitException
SimpleNode.init(org.apache.velocity.context.InternalContextAdapter, java.lang.Object)
public java.lang.String getRootString()
public java.lang.Object execute(java.lang.Object o, InternalContextAdapter context) throws MethodInvocationException
execute
in interface Node
execute
in class SimpleNode
o
- Object parameter, unused per se, but non-null by convention inside an #if/#elseif evaluationcontext
- context used to generate valueMethodInvocationException
Node.execute(java.lang.Object, org.apache.velocity.context.InternalContextAdapter)
public boolean render(InternalContextAdapter context, java.io.Writer writer) throws java.io.IOException, MethodInvocationException
render
in interface Node
render
in interface Renderable
render
in class SimpleNode
context
- context of data to use in getting valuewriter
- writer to render tojava.io.IOException
MethodInvocationException
Node.render(org.apache.velocity.context.InternalContextAdapter, java.io.Writer)
private java.lang.String getNullString(InternalContextAdapter context)
context
- public boolean evaluate(InternalContextAdapter context) throws MethodInvocationException
evaluate
in interface Node
evaluate
in class SimpleNode
context
- context to compute value withMethodInvocationException
Node.evaluate(org.apache.velocity.context.InternalContextAdapter)
public java.lang.Object value(InternalContextAdapter context) throws MethodInvocationException
value
in interface Node
value
in class SimpleNode
MethodInvocationException
SimpleNode.value(org.apache.velocity.context.InternalContextAdapter)
public static java.lang.String printClass(java.lang.Class<?> clazz)
clazz
- public boolean setValue(InternalContextAdapter context, java.lang.Object value) throws MethodInvocationException
context
- context object containing this referencevalue
- Object to set as valueMethodInvocationException
ASTSetDirective
private java.lang.String getRoot()
public java.lang.Object getRootVariableValue(InternalContextAdapter context)
context
- MethodInvocationException