net.sourceforge.pmd.lang.vm.ast
Class ASTReference

java.lang.Object
  extended by net.sourceforge.pmd.lang.ast.AbstractNode
      extended by net.sourceforge.pmd.lang.vm.ast.AbstractVmNode
          extended by net.sourceforge.pmd.lang.vm.ast.ASTReference
All Implemented Interfaces:
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,
Field Summary
 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
 
Fields inherited from class net.sourceforge.pmd.lang.ast.AbstractNode
beginColumn, beginLine, childIndex, children, endColumn, endLine, id, parent
 
Constructor Summary
ASTReference(int id)
           
ASTReference(VmParser p, int id)
           
 
Method Summary
 String getRootString()
          Returns the 'root string', the reference key
 Object jjtAccept(VmParserVisitor visitor, Object data)
          Accept the visitor.
 String literal()
          Override of the SimpleNode method literal() Returns the literal representation of the node.
 void setLiteral(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, isInvalid, jjtClose, jjtOpen, setFirstToken, setInfo, setInvalid, toString, toString
 
Methods inherited from class net.sourceforge.pmd.lang.ast.AbstractNode
appendElement, findChildNodesWithXPath, findChildrenOfType, findDescendantsOfType, findDescendantsOfType, getAsDocument, getBeginColumn, getBeginLine, getDataFlowNode, getEndColumn, getEndLine, getFirstChildOfType, getFirstDescendantOfType, getFirstParentOfType, getImage, getNthParent, getParentsOfType, getUserData, hasDecendantOfAnyType, hasDescendantMatchingXPath, hasDescendantOfType, hasImageEqualTo, isFindBoundary, isSingleLine, jjtAddChild, jjtGetChild, jjtGetChildIndex, jjtGetId, jjtGetNumChildren, jjtGetParent, jjtSetChildIndex, jjtSetParent, setDataFlowNode, setImage, setUserData, testingOnly__setBeginColumn, testingOnly__setBeginLine, testingOnly__setEndColumn, testingOnly__setEndLine
 
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, getFirstParentOfType, getImage, getNthParent, getParentsOfType, getUserData, hasDescendantMatchingXPath, hasDescendantOfType, hasImageEqualTo, isFindBoundary, jjtAddChild, jjtGetChild, jjtGetChildIndex, jjtGetId, jjtGetNumChildren, jjtGetParent, jjtSetChildIndex, jjtSetParent, 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 Object jjtAccept(VmParserVisitor visitor,
                        Object data)
Description copied from interface: VmNode
Accept the visitor. *

Specified by:
jjtAccept in interface VmNode
Overrides:
jjtAccept in class AbstractVmNode
See Also:
org.apache.velocity.runtime.parser.node.SimpleNode#jjtAccept(org.apache.velocity.runtime.parser.node.VmParserVisitor, java.lang.Object)

getRootString

public String getRootString()
Returns the 'root string', the reference key

Returns:
the root string.

setLiteral

public void setLiteral(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 String literal()
Override of the SimpleNode method literal() Returns the literal representation of the node. Should be something like $.

Overrides:
literal in class AbstractVmNode
Returns:
A literal string.
See Also:
org.apache.velocity.runtime.parser.node.Node#literal()


Copyright © 2002–2015 InfoEther. All rights reserved.