Class Trees


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

      Constructors 
      Constructor Description
      Trees()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      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 javax.lang.model.element.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 java.lang.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 java.lang.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 Detail

      • Trees

        Trees()
    • Method Detail

      • 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 java.lang.String getSourceForNode​(com.sun.source.tree.Tree node,
                                                 com.sun.source.util.TreePath path)
        Returns the source text for the node.
      • getMethodName

        static javax.lang.model.element.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 java.lang.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.