Package net.sourceforge.pmd.lang.vm.ast
Class ASTReference
- java.lang.Object
-
- net.sourceforge.pmd.lang.ast.AbstractNode
-
- net.sourceforge.pmd.lang.vm.ast.AbstractVmNode
-
- net.sourceforge.pmd.lang.vm.ast.ASTReference
-
- All Implemented Interfaces:
net.sourceforge.pmd.lang.ast.Node
,VmNode
public class ASTReference extends AbstractVmNode
This class is responsible for handling the references in VTL ($foo). Please look at the Parser.jjt file which is what controls the generation of this class.- Version:
- $Id: ASTReference.java 806597 2009-08-21 15:21:44Z nbubna $
- Author:
- Jason van Zyl, Geir Magnusson Jr., Christoph Reck, Kent Johnson
-
-
Field Summary
Fields Modifier and Type Field Description boolean
strictRef
Indicates if we are running in strict reference mode.boolean
toStringNullCheck
Indicates if toString() should be called during condition evaluation just to ensure it does not return null.-
Fields inherited from class net.sourceforge.pmd.lang.vm.ast.AbstractVmNode
first, info, invalid, last, parser, state, templateName
-
-
Constructor Summary
Constructors Constructor Description ASTReference(int id)
ASTReference(VmParser p, int id)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getRootString()
Returns the 'root string', the reference keyjava.lang.Object
jjtAccept(VmParserVisitor visitor, java.lang.Object data)
Accept the visitor.java.lang.String
literal()
Override of the SimpleNode method literal() Returns the literal representation of the node.void
setLiteral(java.lang.String literal)
Routine to allow the literal representation to be externally overridden.-
Methods inherited from class net.sourceforge.pmd.lang.vm.ast.AbstractVmNode
childrenAccept, dump, getColumn, getFirstToken, getInfo, getLastToken, getLine, getTemplateName, getType, getXPathNodeName, isInvalid, jjtClose, jjtOpen, setFirstToken, setInfo, setInvalid, toString
-
Methods inherited from class net.sourceforge.pmd.lang.ast.AbstractNode
appendElement, findChildNodesWithXPath, findChildrenOfType, findDescendantsOfType, findDescendantsOfType, findDescendantsOfType, getAsDocument, getBeginColumn, getBeginLine, getDataFlowNode, getEndColumn, getEndLine, getFirstChildOfType, getFirstDescendantOfType, getFirstParentOfAnyType, getFirstParentOfType, getImage, getNthParent, getParentsOfType, getUserData, getXPathAttributesIterator, hasDecendantOfAnyType, hasDescendantMatchingXPath, hasDescendantOfAnyType, hasDescendantOfType, hasImageEqualTo, isFindBoundary, isSingleLine, jjtAddChild, jjtGetChild, jjtGetChildIndex, jjtGetFirstToken, jjtGetId, jjtGetLastToken, jjtGetNumChildren, jjtGetParent, jjtSetChildIndex, jjtSetFirstToken, jjtSetLastToken, jjtSetParent, remove, removeChildAtIndex, setDataFlowNode, setImage, setUserData, testingOnlySetBeginColumn, testingOnlySetBeginLine, testingOnlySetEndColumn, testingOnlySetEndLine, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.sourceforge.pmd.lang.ast.Node
findChildNodesWithXPath, findChildrenOfType, findDescendantsOfType, findDescendantsOfType, getAsDocument, getBeginColumn, getBeginLine, getDataFlowNode, getEndColumn, getEndLine, getFirstChildOfType, getFirstDescendantOfType, getFirstParentOfAnyType, getFirstParentOfType, getImage, getNthParent, getParentsOfType, getUserData, getXPathAttributesIterator, hasDescendantMatchingXPath, hasDescendantOfType, hasImageEqualTo, isFindBoundary, jjtAddChild, jjtGetChild, jjtGetChildIndex, jjtGetId, jjtGetNumChildren, jjtGetParent, jjtSetChildIndex, jjtSetParent, remove, removeChildAtIndex, setDataFlowNode, setImage, setUserData
-
-
-
-
Field Detail
-
strictRef
public boolean strictRef
Indicates if we are running in strict reference mode.
-
toStringNullCheck
public boolean toStringNullCheck
Indicates if toString() should be called during condition evaluation just to ensure it does not return null. Check is unnecessary if all toString() implementations are known to have non-null return values. Disabling the check will give a performance improval since toString() may be a complex operation on large objects.
-
-
Constructor Detail
-
ASTReference
public ASTReference(int id)
- Parameters:
id
-
-
ASTReference
public ASTReference(VmParser p, int id)
- Parameters:
p
-id
-
-
-
Method Detail
-
jjtAccept
public java.lang.Object jjtAccept(VmParserVisitor visitor, java.lang.Object data)
Description copied from interface:VmNode
Accept the visitor. *- Specified by:
jjtAccept
in interfaceVmNode
- Overrides:
jjtAccept
in classAbstractVmNode
-
getRootString
public java.lang.String getRootString()
Returns the 'root string', the reference key- Returns:
- the root string.
-
setLiteral
public void setLiteral(java.lang.String literal)
Routine to allow the literal representation to be externally overridden. Used now in the VM system to override a reference in a VM tree with the literal of the calling arg to make it work nicely when calling arg is null. It seems a bit much, but does keep things consistant. Note, you can only set the literal once...- Parameters:
literal
- String to render to when null
-
literal
public java.lang.String literal()
Override of the SimpleNode method literal() Returns the literal representation of the node. Should be something like $<token>.- Overrides:
literal
in classAbstractVmNode
- Returns:
- A literal string.
-
-