ASTNode (Groovy 5.0.8)
Description: declaration: package: org.codehaus.groovy.ast, class: ASTNode

Package org.codehaus.groovy.ast

# Class ASTNode

java.lang.Object
org.codehaus.groovy.ast.ASTNode

All Implemented Interfaces:
  `NodeMetaDataHandler`

Direct Known Subclasses:
  `AnnotatedNode`, `AnnotationNode`, `GenericsType`, `ModifierNode`, `ModuleNode`, `Statement`

public class ASTNode extends Object implements NodeMetaDataHandler
Base class for any AST node. This class supports basic information used in all nodes of the AST:

- line and column number information. Usually a node represents a certain area in a text file determined by a starting position and an ending position. For nodes that do not represent this, this information will be -1. A node can also be configured in its line/col information using another node through setSourcePosition(otherNode).
- every node can store meta data. A phase operation or transform can use this to transport arbitrary information to another phase operation or transform. The only requirement is that the other phase operation or transform runs after the part storing the information. If the information transport is done it is strongly recommended to remove that meta data.
- 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

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ASTNode()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `copyNodeMetaData(ASTNode other)`
  Copies all node metadata from the other node to this one
  `int`
  `getColumnNumber()`
  `int`
  `getLastColumnNumber()`
  `int`
  `getLastLineNumber()`
  `int`
  `getLineNumber()`
  `Map<?,?>`
  `getMetaDataMap()`
  `String`
  `getText()`
  `void`
  `setColumnNumber(int columnNumber)`
  `void`
  `setLastColumnNumber(int lastColumnNumber)`
  `void`
  `setLastLineNumber(int lastLineNumber)`
  `void`
  `setLineNumber(int lineNumber)`
  `void`
  `setMetaDataMap(Map<?,?> metaDataMap)`
  `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`

  ### Methods inherited from interface org.codehaus.groovy.ast.NodeMetaDataHandler

  `copyNodeMetaData, getNodeMetaData, getNodeMetaData, getNodeMetaData, newMetaDataMap, putNodeMetaData, removeNodeMetaData, setNodeMetaData`

- ## Constructor Details

  - ### ASTNode

    public ASTNode()

- ## Method Details

  - ### 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

  - ### copyNodeMetaData

    public void copyNodeMetaData(ASTNode other)
    Copies all node metadata from the other node to this one
    Parameters:
      `other` - - the other node

  - ### getMetaDataMap

    public Map<?,?> getMetaDataMap()
    Specified by:
      `getMetaDataMap` in interface `NodeMetaDataHandler`

  - ### setMetaDataMap

    public void setMetaDataMap(Map<?,?> metaDataMap)
    Specified by:
      `setMetaDataMap` in interface `NodeMetaDataHandler`