Class Trees

java.lang.Object
com.google.googlejavaformat.java.Trees

class Trees extends Object
Utilities for working with Trees.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    (package private) static com.sun.source.tree.ClassTree
    getEnclosingTypeDeclaration(com.sun.source.util.TreePath path)
    Returns the enclosing type declaration (class, enum, interface, or annotation) for the given path.
    (package private) static int
    getEndPosition(com.sun.source.tree.Tree expression, com.sun.source.util.TreePath path)
    Returns the source end position of the node.
    (package private) static int
    getLength(com.sun.source.tree.Tree tree, com.sun.source.util.TreePath path)
    Returns the length of the source for the node.
    (package private) static Name
    getMethodName(com.sun.source.tree.MethodInvocationTree methodInvocation)
    Returns the simple name of a (possibly qualified) method invocation expression.
    (package private) static com.sun.source.tree.ExpressionTree
    getMethodReceiver(com.sun.source.tree.MethodInvocationTree methodInvocation)
    Returns the receiver of a qualified method invocation expression, or null.
    (package private) static String
    getSourceForNode(com.sun.source.tree.Tree node, com.sun.source.util.TreePath path)
    Returns the source text for the node.
    (package private) static int
    getStartPosition(com.sun.source.tree.Tree expression)
    Returns the source start position of the node.
    (package private) static String
    operatorName(com.sun.source.tree.ExpressionTree expression)
    Returns the string name of an operator, including assignment and compound assignment.
    (package private) static int
    precedence(com.sun.source.tree.ExpressionTree expression)
    Returns the precedence of an expression's operator.
    (package private) static com.sun.source.tree.ExpressionTree
    skipParen(com.sun.source.tree.ExpressionTree node)
    Skips a single parenthesized tree.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Trees

      Trees()
  • Method Details

    • getLength

      static int getLength(com.sun.source.tree.Tree tree, com.sun.source.util.TreePath path)
      Returns the length of the source for the node.
    • getStartPosition

      static int getStartPosition(com.sun.source.tree.Tree expression)
      Returns the source start position of the node.
    • getEndPosition

      static int getEndPosition(com.sun.source.tree.Tree expression, com.sun.source.util.TreePath path)
      Returns the source end position of the node.
    • getSourceForNode

      static String getSourceForNode(com.sun.source.tree.Tree node, com.sun.source.util.TreePath path)
      Returns the source text for the node.
    • getMethodName

      static Name getMethodName(com.sun.source.tree.MethodInvocationTree methodInvocation)
      Returns the simple name of a (possibly qualified) method invocation expression.
    • getMethodReceiver

      static com.sun.source.tree.ExpressionTree getMethodReceiver(com.sun.source.tree.MethodInvocationTree methodInvocation)
      Returns the receiver of a qualified method invocation expression, or null.
    • operatorName

      static String operatorName(com.sun.source.tree.ExpressionTree expression)
      Returns the string name of an operator, including assignment and compound assignment.
    • precedence

      static int precedence(com.sun.source.tree.ExpressionTree expression)
      Returns the precedence of an expression's operator.
    • getEnclosingTypeDeclaration

      static com.sun.source.tree.ClassTree getEnclosingTypeDeclaration(com.sun.source.util.TreePath path)
      Returns the enclosing type declaration (class, enum, interface, or annotation) for the given path.
    • skipParen

      static com.sun.source.tree.ExpressionTree skipParen(com.sun.source.tree.ExpressionTree node)
      Skips a single parenthesized tree.