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

Quick Search    Search Deep

Source code: javax/ide/model/java/source/tree/VariableT.java


1   /*
2    * @(#)VariableT.java
3    */
4   
5   package javax.ide.model.java.source.tree;
6   
7   /**
8    * Common supertype for field variables (and enum constant variables),
9    * local variables, and parameters. <p/>
10   *
11   * @author Andy Yu
12   * */
13  public interface VariableT
14    extends Tree, HasModifiersT, HasNameT
15  {
16    // ----------------------------------------------------------------------
17  
18    static final VariableT[] EMPTY_ARRAY = new VariableT[ 0 ];
19  
20  
21    // ----------------------------------------------------------------------
22  
23    /**
24     * Gets the initializer, null if none.
25     *
26     * @return This variable's initializer. Null if none was declared.
27     */
28    public ExpressionT getInitializer();
29  
30    /**
31     * Unlinks the current initializer, if any, and links the input
32     * element.
33     *
34     * @throws IllegalStateException if the input element is already linked.
35     */
36    public void setInitializer( ExpressionT expr );
37  
38  
39    // ----------------------------------------------------------------------
40  
41    /**
42     * Gets the owning variable declaration, null if this is a formal
43     * parameter.
44     *
45     * @return The owning variable declaration. <p/>
46     * <pre>
47     * Field variables (SRC_FIELD_VARIABLE) return SrcFieldDeclaration's.
48     * Formal parameters (SRC_FORMAL_PARAMETER) return null.
49     * Local variables (SRC_LOCAL_VARIABLE) return SrcLocalsDeclaration's.
50     * </pre>
51     */
52    public VariableDeclT getOwningDeclaration();
53  
54  
55    // ----------------------------------------------------------------------
56     
57    /**
58     * Gets the type reference for this element.
59     *
60     * @return This element's type reference.
61     */
62    public TypeReferenceT getType();
63  
64  
65    /**
66     * Unlinks the current source type and links the input element.
67     * 
68     * @param type The new type reference.
69     *
70     * @throws IllegalStateException if the input type is already linked.
71     */
72    public void setType( TypeReferenceT type );
73  
74  }