org.codehaus.groovy.ast
Class ASTNode

java.lang.Object
  extended by org.codehaus.groovy.ast.ASTNode
Direct Known Subclasses:
AnnotatedNode, AnnotationNode, GenericsType, ModuleNode, Statement

public class ASTNode
extends Object

Base class for any AST node. This class supports basic information used in all nodes of the AST

  • a text representation of this node trough getText(). This was in the past used for assertion messages. Since the usage of power asserts this method will not be called for this purpose anymore and might be removed in future versions of Groovy
  • Version:
    $Revision$
    Author:
    James Strachan,

    Constructor Summary
    ASTNode()
               
     
    Method Summary
     void copyNodeMetaData(ASTNode other)
              Copies all node meta data from one node to the other
     int getColumnNumber()
               
     int getLastColumnNumber()
               
     int getLastLineNumber()
               
     int getLineNumber()
               
     Object getNodeMetaData(Object key)
              Gets the node meta data.
     String getText()
               
     Object putNodeMetaData(Object key, Object value)
              Sets the node meta data but allows overwriting values.
     void removeNodeMetaData(Object key)
              Removes a node meta data entry.
     void setColumnNumber(int columnNumber)
               
     void setLastColumnNumber(int lastColumnNumber)
               
     void setLastLineNumber(int lastLineNumber)
               
     void setLineNumber(int lineNumber)
               
     void setNodeMetaData(Object key, Object value)
              Sets the node meta data.
     void setSourcePosition(ASTNode node)
              Sets the source position using another ASTNode.
     void visit(GroovyCodeVisitor visitor)
               
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Constructor Detail

    ASTNode

    public ASTNode()
    Method Detail

    visit

    public void visit(GroovyCodeVisitor visitor)

    getText

    public String getText()

    getLineNumber

    public int getLineNumber()

    setLineNumber

    public void setLineNumber(int lineNumber)

    getColumnNumber

    public int getColumnNumber()

    setColumnNumber

    public void setColumnNumber(int columnNumber)

    getLastLineNumber

    public int getLastLineNumber()

    setLastLineNumber

    public void setLastLineNumber(int lastLineNumber)

    getLastColumnNumber

    public int getLastColumnNumber()

    setLastColumnNumber

    public void setLastColumnNumber(int lastColumnNumber)

    setSourcePosition

    public void setSourcePosition(ASTNode node)
    Sets the source position using another ASTNode. The sourcePosition consists of a line/column pair for the start and a line/column pair for the end of the expression or statement

    Parameters:
    node - - the node used to configure the position information

    getNodeMetaData

    public Object getNodeMetaData(Object key)
    Gets the node meta data.

    Parameters:
    key - - the meta data key
    Returns:
    the node meta data value for this key

    copyNodeMetaData

    public void copyNodeMetaData(ASTNode other)
    Copies all node meta data from one node to the other

    Parameters:
    other - - the other node

    setNodeMetaData

    public void setNodeMetaData(Object key,
                                Object value)
    Sets the node meta data.

    Parameters:
    key - - the meta data key
    value - - the meta data value
    Throws:
    GroovyBugError - if key is null or there is already meta data under that key

    putNodeMetaData

    public Object putNodeMetaData(Object key,
                                  Object value)
    Sets the node meta data but allows overwriting values.

    Parameters:
    key - - the meta data key
    value - - the meta data value
    Returns:
    the old node meta data value for this key
    Throws:
    GroovyBugError - if key is null

    removeNodeMetaData

    public void removeNodeMetaData(Object key)
    Removes a node meta data entry.

    Parameters:
    key - - the meta data key
    Throws:
    GroovyBugError - if the key is null

    Copyright © 2003-2012 The Codehaus. All rights reserved.