Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.1.0)

E17493-02

javax.ide.model.java.source.tree
Interface Tree

All Known Subinterfaces:
AnnotationExpressionT, AnnotationT, ArrayAccessExpressionT, AssertStatementT, AssignmentExpressionT, BlockElementT, BlockStatementT, BlockT, BreakStatementT, CatchClauseT, ClassBodyT, ClassInitializerT, ClassT, CompoundStatementT, ConditionalStatementT, ContinueStatementT, DereferenceExpressionT, DocCommentT, DoStatementT, DotExpressionT, ElseClauseT, EmptyStatementT, EnumConstantT, ExpressionStatementT, ExpressionT, FieldDeclT, FieldVariableT, FileT, FinallyClauseT, FormalParameterListT, FormalParameterT, ForStatementT, HasModifiersT, HasNameT, IdentifierExpressionT, IfStatementT, ImportT, InfixExpressionT, InterfacesT, InvokeExpressionT, ListExpressionT, LiteralExpressionT, LocalVariableDeclT, LocalVariableT, MemberT, MemberVariableT, MethodCallExpressionT, MethodT, NameT, NewArrayExpressionT, NewClassExpressionT, OperatorExpressionT, PackageT, QuestionExpressionT, ReturnStatementT, SimpleStatementT, StatementLabelT, StatementT, SuperclassT, SwitchLabelT, SwitchStatementT, SynchStatementT, ThrowsT, ThrowStatementT, TryStatementT, TypeArgumentT, TypecastExpressionT, TypeExpressionT, TypeParameterT, TypeReferenceT, UnaryExpressionT, VariableDeclT, VariableT, WhileStatementT, WrapperExpressionT

public interface Tree

Base supertype of all AST nodes in the parse tree.


Field Summary
static Tree[] EMPTY_ARRAY
           
 
Method Summary
 void accept(TreeVisitor v)
          Visits this element.
 void addSelf(Tree parent)
          Performs an add (usually append) of this element to the parent.
 void addSelf(Tree sibling, boolean before)
          Performs an add of this element to the parent of the input sibling.
 void addSelfAfter(Tree sibling)
           
 void addSelfBefore(Tree sibling)
           
 java.lang.Object clearProperty(java.lang.String key)
          Nulls out the property stored with the given key.
 Tree cloneSelf(FileT targetFile)
          Performs a deep-copy of this Tree but attached to the input FileT.
 java.util.List getChildren()
          Gets the list of children Trees.
 FileT getOwningFile()
          Gets the owning FileT.
 Tree getParent()
          Gets the parent Tree to this.
 SourcePosition getPosition()
          Gets the position of this Tree object.
 java.lang.Object getProperty(java.lang.String key)
          Gets the property saved with the given key, null if none.
 Tree getSiblingAfter()
          Gets the sibling after this.
 Tree getSiblingBefore()
          Gets the sibling before this.
 java.util.ListIterator getSiblings()
          Gets a ListIterator for this Tree's siblings.
 TreeKind getTreeKind()
          Identifies what kind of Tree this is.
 boolean isSynthetic()
          True if this Tree element corresponds to an actual source representation.
 void removeSelf()
          Performs a remove of this element from its parent.
 void replaceSelf(Tree newElement)
          Performs a set of this element with the newElement.
 java.lang.Object setProperty(java.lang.String key, java.lang.Object data)
          Stores the input property.
 

Field Detail

EMPTY_ARRAY

static final Tree[] EMPTY_ARRAY
Method Detail

getTreeKind

TreeKind getTreeKind()
Identifies what kind of Tree this is.

Returns:
What kind of Tree this is.

getPosition

SourcePosition getPosition()
Gets the position of this Tree object. If not synthetic, this must always return non-null. If the position is unknown, zero may be returned.

The line and column must both be non-negative, but the URI may be null.

Returns:
The position of this Tree object, null if this Tree object is synthetic.

isSynthetic

boolean isSynthetic()
True if this Tree element corresponds to an actual source representation.

Returns:
True if this Tree element corresponds to an actual source representation. One example of a synthetic element is the default constructor generated when a "class" or "enum" declaration does not declare any constructors. Another example of a synthetic element is the generated-on-the-fly InterfacesT element returned by ClassT.getInterfacesClause() when there is no interfaces declaration.

getOwningFile

FileT getOwningFile()
Gets the owning FileT.

Returns:
The owning FileT for this node.

getParent

Tree getParent()
Gets the parent Tree to this.

Returns:
The parent of this node.

getChildren

java.util.List getChildren()
Gets the list of children Trees.

Returns:
The array of non-token children linked to this element.

List of Trees.


getSiblings

java.util.ListIterator getSiblings()
Gets a ListIterator for this Tree's siblings.

Returns:
The same behavior as ListIterator. The "this" element will be returned via an initial call to next(). If the initial call is prev(), then the previous element will be returned.

Note: Unlike ListIterator, next() and previous() will return null instead of throwing NoSuchElementException's. That allows the client to safely call getSiblings().previous() and getSiblings().next().


accept

void accept(TreeVisitor v)
Visits this element.


getSiblingBefore

Tree getSiblingBefore()
Gets the sibling before this.

This operation currently performs in time proportional to the number of siblings this element has. That is, this is not a fast operation.

Returns:
This element's sibling with an earlier start offset. Null if none.

getSiblingAfter

Tree getSiblingAfter()
Gets the sibling after this.

This operation currently performs in time proportional to the number of siblings this element has. That is, this is not a fast operation.

Returns:
This element's sibling with a later start offset. Null if none.

cloneSelf

Tree cloneSelf(FileT targetFile)
Performs a deep-copy of this Tree but attached to the input FileT. If this element has children, then the clone of this element will have, as its children, clones of this element's children.

Properties are not copied.

Cloning a FileT in this manner results in an UnsupportedOperationException. To clone a FileT, please use TreeManager.cloneSourceFile(FileT,FileT).

Returns:
An unattached deep-copy of this Tree. "Deep copy" is explained above. "Unattached" means unparented.
Throws:
java.lang.UnsupportedOperationException - if this is a FileT.

addSelf

void addSelf(Tree parent)
Performs an add (usually append) of this element to the parent. Insertion point is left to the discretion of the implementation.

Throws:
java.lang.UnsupportedOperationException - if this element may not be added.
java.lang.IllegalStateException - if this element already has a parent.

addSelf

void addSelf(Tree sibling,
             boolean before)
Performs an add of this element to the parent of the input sibling.

Parameters:
before - If true, this element will be added before the sibling. If false, this element will be added after the sibling.
Throws:
java.lang.UnsupportedOperationException - if addSelf does same.
java.lang.IllegalStateException - if addSelf does same or if sibling does not have a parent.

addSelfBefore

void addSelfBefore(Tree sibling)

addSelfAfter

void addSelfAfter(Tree sibling)

replaceSelf

void replaceSelf(Tree newElement)
Performs a set of this element with the newElement.

Throws:
java.lang.UnsupportedOperationException - if this element may not be removed or the new element may not be added.
java.lang.IllegalStateException - if this element does not have a parent or if the new element already has a parent.

removeSelf

void removeSelf()
Performs a remove of this element from its parent.

Throws:
java.lang.UnsupportedOperationException - if this element may not be removed.
java.lang.IllegalStateException - if the element does not have a parent.

getProperty

java.lang.Object getProperty(java.lang.String key)
Gets the property saved with the given key, null if none. To prevent collisions, clients should pick keys that start with the calling class's Class.getName() value.

Returns:
The property of the given type that is stored in this node, null if none.

setProperty

java.lang.Object setProperty(java.lang.String key,
                             java.lang.Object data)
Stores the input property. Overwrites any property stored under the same key.

Returns:
The overwritten property, null if none.

clearProperty

java.lang.Object clearProperty(java.lang.String key)
Nulls out the property stored with the given key.

Returns:
The previously stored property, null if none.

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.1.0)

E17493-02

Copyright © 1997, 2011, Oracle. All rights reserved.