Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

javax.ide.model.java.source.tree
Class TreeKind  view TreeKind download TreeKind.java

java.lang.Object
  extended byjavax.ide.model.java.source.tree.TreeKind

public final class TreeKind
extends java.lang.Object

The TreeKind enumeration identifies each individual kind of Tree.

For code-readability, all constants have been prefixed as TREE_*. Constants for subinterfaces of StatementT have been prefixed as TREE_STMT_*. Constants for subinterfaces of ExpressionT have been prefixed as TREE_EXPR_*. Constants for subinterfaces of DocT have been prefixed as TREE_DOC_*.

Though the doc structure is not part of the Java Language specification (moreover, there is no specification of doc structure), doc comment constants have been included because refactoring features may need to access and mutate doc comment contents.

In this version, this class is 1.4 compatible. In a later version, it will be redone as an enum.


Field Summary
private  java.lang.String name
           
private  int ordinal
           
static int TREE_ANNOTATION
          An annotation.
static int TREE_base
           
static int TREE_BLOCK
          A code block.
static int TREE_CLASS_BODY
          A body of a class declaration.
static int TREE_CLASS_D
          A class, enum, interface, or annotation type declaration.
static int TREE_CLASS_INITIALIZER
          An initializer in a class declaration.
private static java.lang.Class[] TREE_classes
           
static int TREE_CONSTRUCTOR_D
          A constructor declaration.
static int TREE_DOC_COMMENT
          A doc comment.
static int TREE_DOC_TAG
          An inline doc tag.
static int TREE_ENUM_CONSTANT_D
          An enum constant declaration.
static int TREE_EXPR_ANNOTATION
          An expression wrapping an annotation.
static int TREE_EXPR_ARRAY_ACCESS
          An array access expression.
static int TREE_EXPR_ARRAY_CREATOR
          An array creator expression.
static int TREE_EXPR_ASSIGNMENT
          An expression for an assignment operation.
static int TREE_EXPR_base
           
static int TREE_EXPR_CLASS_CREATOR
          A class creator expression.
static int TREE_EXPR_DOT
          An expression for an identifier selector.
static int TREE_EXPR_IDENTIFIER
          An identifier expression.
static int TREE_EXPR_INFIX
          An expression for an infix operation.
static int TREE_EXPR_LIST
          A list of expressions.
static int TREE_EXPR_LITERAL
          A literal.
static int TREE_EXPR_max
           
static int TREE_EXPR_METHOD_CALL
          A method call.
static int TREE_EXPR_QUESTION
          An expression for the conditional operator.
static int TREE_EXPR_TYPE
          An expression wrapping a type reference.
static int TREE_EXPR_TYPECAST
          An expression for a typecast operation.
static int TREE_EXPR_UNARY
          An expression for a prefix or postfix operation.
static int TREE_EXPR_WRAPPER
          An expression wrapping another expression.
static int TREE_FIELD_D
          A field declaration that is not for an enum constant.
static int TREE_FIELD_VARIABLE
          A field variable.
static int TREE_FILE
          A source file (a compilation unit).
static int TREE_FORMAL_PARAMETER
          A formal parameter.
static int TREE_FORMAL_PARAMETER_LIST
          A formal parameter list.
static int TREE_IMPORT_D
          An import declaration.
static int TREE_INTERFACES_D
          An interfaces clause for a class declaration.
static int TREE_invalid
           
static int TREE_LOCAL_VARIABLE
          A local variable.
static int TREE_LOCAL_VARIABLE_D
          A local variable declaration.
static int TREE_max
           
static int TREE_METHOD_D
          A method declaration that is not for a constructor.
static int TREE_MODIFIERS
          Declaration modifiers.
static int TREE_NAME
          A name, either a simple name or a qualified name.
private static java.lang.String[] TREE_names
           
static int TREE_PACKAGE_D
          A package declaration.
static int TREE_STATEMENT_LABEL
          A statement label.
static int TREE_STMT_ASSERT
          An assert statement.
static int TREE_STMT_base
           
static int TREE_STMT_BLOCK
          A statement wrapping a block.BlockStatementT.
static int TREE_STMT_BREAK
          A break statement.
static int TREE_STMT_CATCH
          A catch clause in a try statement.
static int TREE_STMT_CONTINUE
          A continue statement.
static int TREE_STMT_DO
          A do-while statement.
static int TREE_STMT_ELSE
          An else clause in an if statement.
static int TREE_STMT_EMPTY
          An empty statement.
static int TREE_STMT_EXPRESSION
          A statement wrapping an expression.
static int TREE_STMT_FINALLY
          A finally clause in a try statement.
static int TREE_STMT_FOR
          A for statement, all variants.
static int TREE_STMT_IF
          An if statement.
static int TREE_STMT_max
           
static int TREE_STMT_RETURN
          A return statement.
static int TREE_STMT_SWITCH
          A switch statement.
static int TREE_STMT_SYNCH
          A synchronized statement.
static int TREE_STMT_THROW
          A throw statement.
static int TREE_STMT_TRY
          A try statement.
static int TREE_STMT_WHILE
          A while statement.
static int TREE_SUPERCLASS
          A super-class clause for a class declaration.
static int TREE_SWITCH_LABEL
          A switch case label, either case or default.
static int TREE_THROWS
          A throws clause for a method declaration.
static int TREE_TYPE_ARGUMENT
          A type argument in a type reference.
static int TREE_TYPE_PARAMETER
          A type parameter declaration.
static int TREE_TYPE_REFERENCE
          A type reference.
private  java.lang.Class treeClass
           
private static java.util.Map values
           
 
Constructor Summary
private TreeKind(int ordinal, java.lang.String name, java.lang.Class treeClass)
           
 
Method Summary
 int compareTo(TreeKind other)
           
 boolean equals(java.lang.Object other)
          Determine whether this Object is semantically equal to another Object.
 java.lang.Class getDeclaringClass()
           
 java.lang.Class getTreeClass()
           
 int hashCode()
          Get a value that represents this Object, as uniquely as possible within the confines of an int.
 java.lang.String name()
           
 int ordinal()
           
 java.lang.String toString()
          Convert this Object to a human-readable String.
static TreeKind valueOf(java.lang.Class ignored, java.lang.String name)
           
static TreeKind valueOf(int ordinal)
           
static TreeKind[] values()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

TREE_invalid

public static final int TREE_invalid
See Also:
Constant Field Values

TREE_base

public static final int TREE_base
See Also:
Constant Field Values

TREE_ANNOTATION

public static final int TREE_ANNOTATION
An annotation. AnnotationT.

See Also:
Constant Field Values

TREE_BLOCK

public static final int TREE_BLOCK
A code block. BlockT.

See Also:
Constant Field Values

TREE_CLASS_BODY

public static final int TREE_CLASS_BODY
A body of a class declaration. ClassBodyT.

See Also:
Constant Field Values

TREE_CLASS_D

public static final int TREE_CLASS_D
A class, enum, interface, or annotation type declaration. ClassT.

See Also:
Constant Field Values

TREE_CLASS_INITIALIZER

public static final int TREE_CLASS_INITIALIZER
An initializer in a class declaration. ClassInitializerT.

See Also:
Constant Field Values

TREE_CONSTRUCTOR_D

public static final int TREE_CONSTRUCTOR_D
A constructor declaration. MethodT.

See Also:
Constant Field Values

TREE_ENUM_CONSTANT_D

public static final int TREE_ENUM_CONSTANT_D
An enum constant declaration. FieldDeclT.

See Also:
Constant Field Values

TREE_FIELD_D

public static final int TREE_FIELD_D
A field declaration that is not for an enum constant. FieldDeclT.

See Also:
Constant Field Values

TREE_FIELD_VARIABLE

public static final int TREE_FIELD_VARIABLE
A field variable. FieldVariableT.

See Also:
Constant Field Values

TREE_FILE

public static final int TREE_FILE
A source file (a compilation unit). FileT.

See Also:
Constant Field Values

TREE_FORMAL_PARAMETER

public static final int TREE_FORMAL_PARAMETER
A formal parameter. FormalParameterT.

See Also:
Constant Field Values

TREE_FORMAL_PARAMETER_LIST

public static final int TREE_FORMAL_PARAMETER_LIST
A formal parameter list. FormalParameterListT.

See Also:
Constant Field Values

TREE_IMPORT_D

public static final int TREE_IMPORT_D
An import declaration. ImportT.

See Also:
Constant Field Values

TREE_INTERFACES_D

public static final int TREE_INTERFACES_D
An interfaces clause for a class declaration. On a "class" declaration, this will be the "implements" clause. On an "interface" declaration, this will be the "extends" clause.

The name "interfaces" was taken from reflection.

See Also:
InterfacesT. 55 , Constant Field Values

TREE_LOCAL_VARIABLE

public static final int TREE_LOCAL_VARIABLE
A local variable. LocalVariableT.

See Also:
Constant Field Values

TREE_LOCAL_VARIABLE_D

public static final int TREE_LOCAL_VARIABLE_D
A local variable declaration. LocalVariableDeclT.

See Also:
Constant Field Values

TREE_METHOD_D

public static final int TREE_METHOD_D
A method declaration that is not for a constructor. MethodT.

See Also:
Constant Field Values

TREE_MODIFIERS

public static final int TREE_MODIFIERS
Declaration modifiers. ModifiersT.

See Also:
Constant Field Values

TREE_NAME

public static final int TREE_NAME
A name, either a simple name or a qualified name. NameT.

See Also:
Constant Field Values

TREE_PACKAGE_D

public static final int TREE_PACKAGE_D
A package declaration. PackageT.

See Also:
Constant Field Values

TREE_STATEMENT_LABEL

public static final int TREE_STATEMENT_LABEL
A statement label. StatementLabelT.

See Also:
Constant Field Values

TREE_SUPERCLASS

public static final int TREE_SUPERCLASS
A super-class clause for a class declaration. On a "class" declaration, this will be the "extends" clause. The name "superclass" was taken from reflection.

See Also:
SuperclassT. 55 , Constant Field Values

TREE_SWITCH_LABEL

public static final int TREE_SWITCH_LABEL
A switch case label, either case or default. SwitchLabelT.

See Also:
Constant Field Values

TREE_THROWS

public static final int TREE_THROWS
A throws clause for a method declaration. ThrowsT.

See Also:
Constant Field Values

TREE_TYPE_REFERENCE

public static final int TREE_TYPE_REFERENCE
A type reference. TypeReferenceT.

See Also:
Constant Field Values

TREE_TYPE_ARGUMENT

public static final int TREE_TYPE_ARGUMENT
A type argument in a type reference. TypeArgumentT.

See Also:
Constant Field Values

TREE_TYPE_PARAMETER

public static final int TREE_TYPE_PARAMETER
A type parameter declaration. TypeParameterT.

See Also:
Constant Field Values

TREE_STMT_ASSERT

public static final int TREE_STMT_ASSERT
An assert statement. AssertStatementT.

See Also:
Constant Field Values

TREE_STMT_BLOCK

public static final int TREE_STMT_BLOCK
A statement wrapping a block.BlockStatementT.

See Also:
Constant Field Values

TREE_STMT_BREAK

public static final int TREE_STMT_BREAK
A break statement. BreakStatementT.

See Also:
Constant Field Values

TREE_STMT_CATCH

public static final int TREE_STMT_CATCH
A catch clause in a try statement. CatchClauseT.

See Also:
Constant Field Values

TREE_STMT_CONTINUE

public static final int TREE_STMT_CONTINUE
A continue statement. ContinueStatementT.

See Also:
Constant Field Values

TREE_STMT_DO

public static final int TREE_STMT_DO
A do-while statement. DoStatementT.

See Also:
Constant Field Values

TREE_STMT_ELSE

public static final int TREE_STMT_ELSE
An else clause in an if statement. ElseClauseT.

See Also:
Constant Field Values

TREE_STMT_EMPTY

public static final int TREE_STMT_EMPTY
An empty statement. EmptyStatementT.

See Also:
Constant Field Values

TREE_STMT_EXPRESSION

public static final int TREE_STMT_EXPRESSION
A statement wrapping an expression. ExpressionStatementT.

See Also:
Constant Field Values

TREE_STMT_FINALLY

public static final int TREE_STMT_FINALLY
A finally clause in a try statement. FinallyClauseT.

See Also:
Constant Field Values

TREE_STMT_FOR

public static final int TREE_STMT_FOR
A for statement, all variants. ForStatementT.

See Also:
Constant Field Values

TREE_STMT_IF

public static final int TREE_STMT_IF
An if statement. IfStatementT.

See Also:
Constant Field Values

TREE_STMT_RETURN

public static final int TREE_STMT_RETURN
A return statement. ReturnStatementT.

See Also:
Constant Field Values

TREE_STMT_SWITCH

public static final int TREE_STMT_SWITCH
A switch statement. SwitchStatementT.

See Also:
Constant Field Values

TREE_STMT_SYNCH

public static final int TREE_STMT_SYNCH
A synchronized statement. SynchStatementT.

See Also:
Constant Field Values

TREE_STMT_THROW

public static final int TREE_STMT_THROW
A throw statement. ThrowStatementT.

See Also:
Constant Field Values

TREE_STMT_TRY

public static final int TREE_STMT_TRY
A try statement. TryStatementT.

See Also:
Constant Field Values

TREE_STMT_WHILE

public static final int TREE_STMT_WHILE
A while statement. WhileStatementT.

See Also:
Constant Field Values

TREE_EXPR_ANNOTATION

public static final int TREE_EXPR_ANNOTATION
An expression wrapping an annotation. Used only in annotations. AnnotationExpressionT.

See Also:
Constant Field Values

TREE_EXPR_ARRAY_ACCESS

public static final int TREE_EXPR_ARRAY_ACCESS
An array access expression. ArrayAccessExpressionT.

See Also:
Constant Field Values

TREE_EXPR_ARRAY_CREATOR

public static final int TREE_EXPR_ARRAY_CREATOR
An array creator expression. NewArrayExpressionT.

See Also:
Constant Field Values

TREE_EXPR_ASSIGNMENT

public static final int TREE_EXPR_ASSIGNMENT
An expression for an assignment operation. AssignmentExpressionT.

See Also:
Constant Field Values

TREE_EXPR_CLASS_CREATOR

public static final int TREE_EXPR_CLASS_CREATOR
A class creator expression. NewClassExpressionT.

See Also:
Constant Field Values

TREE_EXPR_DOT

public static final int TREE_EXPR_DOT
An expression for an identifier selector. DotExpressionT.

See Also:
Constant Field Values

TREE_EXPR_IDENTIFIER

public static final int TREE_EXPR_IDENTIFIER
An identifier expression. IdentifierExpressionT.

See Also:
Constant Field Values

TREE_EXPR_INFIX

public static final int TREE_EXPR_INFIX
An expression for an infix operation. InfixExpressionT.

See Also:
Constant Field Values

TREE_EXPR_LIST

public static final int TREE_EXPR_LIST
A list of expressions. May be an argument list or an array constant. ListExpressionT.

See Also:
Constant Field Values

TREE_EXPR_LITERAL

public static final int TREE_EXPR_LITERAL
A literal. LiteralExpressionT.

See Also:
Constant Field Values

TREE_EXPR_METHOD_CALL

public static final int TREE_EXPR_METHOD_CALL
A method call. MethodCallExpressionT.

See Also:
Constant Field Values

TREE_EXPR_QUESTION

public static final int TREE_EXPR_QUESTION
An expression for the conditional operator. QuestionExpressionT.

See Also:
Constant Field Values

TREE_EXPR_TYPE

public static final int TREE_EXPR_TYPE
An expression wrapping a type reference. TypeExpressionT.

See Also:
Constant Field Values

TREE_EXPR_TYPECAST

public static final int TREE_EXPR_TYPECAST
An expression for a typecast operation. TypecastExpressionT.

See Also:
Constant Field Values

TREE_EXPR_UNARY

public static final int TREE_EXPR_UNARY
An expression for a prefix or postfix operation. Also includes keyword selectors. UnaryExpressionT.

See Also:
Constant Field Values

TREE_EXPR_WRAPPER

public static final int TREE_EXPR_WRAPPER
An expression wrapping another expression. Will be either a parenthesis wrapper or a bracket wrapper. WrapperExpressionT.

See Also:
Constant Field Values

TREE_DOC_COMMENT

public static final int TREE_DOC_COMMENT
A doc comment. DocCommentT.

See Also:
Constant Field Values

TREE_DOC_TAG

public static final int TREE_DOC_TAG
An inline doc tag. DocTagT.

See Also:
Constant Field Values

TREE_STMT_base

public static final int TREE_STMT_base
See Also:
Constant Field Values

TREE_STMT_max

public static final int TREE_STMT_max
See Also:
Constant Field Values

TREE_EXPR_base

public static final int TREE_EXPR_base
See Also:
Constant Field Values

TREE_EXPR_max

public static final int TREE_EXPR_max
See Also:
Constant Field Values

TREE_max

public static final int TREE_max
See Also:
Constant Field Values

ordinal

private final int ordinal

name

private final java.lang.String name

treeClass

private final java.lang.Class treeClass

values

private static final java.util.Map values

TREE_names

private static final java.lang.String[] TREE_names

TREE_classes

private static final java.lang.Class[] TREE_classes
Constructor Detail

TreeKind

private TreeKind(int ordinal,
                 java.lang.String name,
                 java.lang.Class treeClass)
Method Detail

getTreeClass

public java.lang.Class getTreeClass()

name

public java.lang.String name()

toString

public java.lang.String toString()
Description copied from class: java.lang.Object
Convert this Object to a human-readable String. There are no limits placed on how long this String should be or what it should contain. We suggest you make it as intuitive as possible to be able to place it into System.out.println() 55 and such.

It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.

This method will be called when performing string concatenation with this object. If the result is null, string concatenation will instead use "null".

The default implementation returns getClass().getName() + "@" + Integer.toHexString(hashCode()).


ordinal

public int ordinal()

hashCode

public int hashCode()
Description copied from class: java.lang.Object
Get a value that represents this Object, as uniquely as possible within the confines of an int.

There are some requirements on this method which subclasses must follow:

  • Semantic equality implies identical hashcodes. In other words, if a.equals(b) is true, then a.hashCode() == b.hashCode() must be as well. However, the reverse is not necessarily true, and two objects may have the same hashcode without being equal.
  • It must be consistent. Whichever value o.hashCode() returns on the first invocation must be the value returned on all later invocations as long as the object exists. Notice, however, that the result of hashCode may change between separate executions of a Virtual Machine, because it is not invoked on the same object.

Notice that since hashCode is used in java.util.Hashtable and other hashing classes, a poor implementation will degrade the performance of hashing (so don't blindly implement it as returning a constant!). Also, if calculating the hash is time-consuming, a class may consider caching the results.

The default implementation returns System.identityHashCode(this)


compareTo

public int compareTo(TreeKind other)

equals

public boolean equals(java.lang.Object other)
Description copied from class: java.lang.Object
Determine whether this Object is semantically equal to another Object.

There are some fairly strict requirements on this method which subclasses must follow:

  • It must be transitive. If a.equals(b) and b.equals(c), then a.equals(c) must be true as well.
  • It must be symmetric. a.equals(b) and b.equals(a) must have the same value.
  • It must be reflexive. a.equals(a) must always be true.
  • It must be consistent. Whichever value a.equals(b) returns on the first invocation must be the value returned on all later invocations.
  • a.equals(null) must be false.
  • It must be consistent with hashCode(). That is, a.equals(b) must imply a.hashCode() == b.hashCode(). The reverse is not true; two objects that are not equal may have the same hashcode, but that has the potential to harm hashing performance.

This is typically overridden to throw a java.lang.ClassCastException if the argument is not comparable to the class performing the comparison, but that is not a requirement. It is legal for a.equals(b) to be true even though a.getClass() != b.getClass(). Also, it is typical to never cause a java.lang.NullPointerException.

In general, the Collections API (java.util) use the equals method rather than the == operator to compare objects. However, java.util.IdentityHashMap is an exception to this rule, for its own good reasons.

The default implementation returns this == o.


getDeclaringClass

public java.lang.Class getDeclaringClass()

valueOf

public static TreeKind valueOf(int ordinal)

valueOf

public static TreeKind valueOf(java.lang.Class ignored,
                               java.lang.String name)

values

public static TreeKind[] values()