removed unused private methods.
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / core / dom / IVariableBinding.java
1 /*******************************************************************************
2  * Copyright (c) 2000, 2008 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  *     IBM Corporation - initial API and implementation
10  *******************************************************************************/
11
12 package net.sourceforge.phpdt.core.dom;
13
14 /**
15  * A variable binding represents either a field of a class or interface, or 
16  * a local variable declaration (including formal parameters, local variables, 
17  * and exception variables).
18  *
19  * @see ITypeBinding#getDeclaredFields()
20  * @since 2.0
21  * @noimplement This interface is not intended to be implemented by clients.
22  */
23 public interface IVariableBinding extends IBinding {
24         
25         /**
26          * Returns whether this binding is for a field.
27          * Note that this method returns <code>true</code> for constants,
28          * including enum constants. This method returns <code>false</code>
29          * for local variables.
30          * 
31          * @return <code>true</code> if this is the binding for a field,
32          *    and <code>false</code> otherwise
33          */ 
34         public boolean isField();
35         
36         /**
37          * Returns whether this binding is for an enum constant.
38          * Note that this method returns <code>false</code> for local variables
39          * and for fields other than enum constants.
40          * 
41          * @return <code>true</code> if this is the binding for an enum constant,
42          *    and <code>false</code> otherwise
43          * @since 3.1
44          */ 
45         public boolean isEnumConstant();
46         
47         /**
48          * Returns whether this binding corresponds to a parameter. 
49          * 
50          * @return <code>true</code> if this is the binding for a parameter,
51          *    and <code>false</code> otherwise
52          * @since 3.2
53          */
54         public boolean isParameter();
55
56         /**
57          * Returns the name of the field or local variable declared in this binding.
58          * The name is always a simple identifier.
59          * 
60          * @return the name of this field or local variable
61          */
62         public String getName();
63         
64         /**
65          * Returns the type binding representing the class or interface
66          * that declares this field.
67          * <p>
68          * The declaring class of a field is the class or interface of which it is
69          * a member. Local variables have no declaring class. The field length of an 
70          * array type has no declaring class.
71          * </p>
72          * 
73          * @return the binding of the class or interface that declares this field,
74          *   or <code>null</code> if none
75          */
76         public ITypeBinding getDeclaringClass();
77
78         /**
79          * Returns the binding for the type of this field or local variable.
80          * 
81          * @return the binding for the type of this field or local variable
82          */
83         public ITypeBinding getType();
84         
85         /**
86          * Returns a small integer variable id for this variable binding.
87          * <p>
88          * <b>Local variables inside methods:</b> Local variables (and parameters)
89          * declared within a single method are assigned ascending ids in normal
90          * code reading order; var1.getVariableId()&lt;var2.getVariableId() means that var1 is
91          * declared before var2.
92          * </p>
93          * <p>
94          * <b>Local variables outside methods:</b> Local variables declared in a
95          * type's static initializers (or initializer expressions of static fields)
96          * are assigned ascending ids in normal code reading order. Local variables
97          * declared in a type's instance initializers (or initializer expressions
98          * of non-static fields) are assigned ascending ids in normal code reading
99          * order. These ids are useful when checking definite assignment for
100          * static initializers (JLS 16.7) and instance initializers (JLS 16.8), 
101          * respectively.
102          * </p>
103          * <p>
104          * <b>Fields:</b> Fields declared as members of a type are assigned 
105          * ascending ids in normal code reading order; 
106          * field1.getVariableId()&lt;field2.getVariableId() means that field1 is declared before
107          * field2.
108          * </p>
109          * 
110          * @return a small non-negative variable id
111          */
112         public int getVariableId();
113         
114         /**
115          * Returns this binding's constant value if it has one.
116          * Some variables may have a value computed at compile-time. If the type of
117          * the value is a primitive type, the result is the boxed equivalent (i.e.,
118          * int returned as an <code>Integer</code>). If the type of the value is
119          * <code>String</code>, the result is the string itself. If the variable has
120          * no compile-time computed value, the result is <code>null</code>.
121          * (Note: compile-time constant expressions cannot denote <code>null</code>;
122          * JLS2 15.28.). The result is always <code>null</code> for enum constants.
123          * 
124          * @return the constant value, or <code>null</code> if none
125          * @since 3.0
126          */
127         public Object getConstantValue();
128         
129         /**
130          * Returns the method binding representing the method containing the scope
131          * in which this local variable is declared.
132          * <p>
133          * The declaring method of a method formal parameter is the method itself.
134          * For a local variable declared somewhere within the body of a method,
135          * the declaring method is the enclosing method. When local or anonymous
136          * classes are involved, the declaring method is the innermost such method.
137          * There is no declaring method for a field, or for a local variable
138          * declared in a static or instance initializer; this method returns
139          * <code>null</code> in those cases.
140          * </p>
141          * 
142          * @return the binding of the method or constructor that declares this
143          * local variable, or <code>null</code> if none
144          * @since 3.1
145          */
146         public IMethodBinding getDeclaringMethod();
147         
148         /**
149          * Returns the binding for the variable declaration corresponding to this
150          * variable binding. For a binding for a field declaration in an instance
151          * of a generic type, this method returns the binding for the corresponding
152          * field declaration in the generic type. For other variable bindings,
153          * including all ones for local variables and parameters, this method
154          * returns the same binding.
155          *
156          * @return the variable binding for the originating declaration
157          * @since 3.1
158          */
159         public IVariableBinding getVariableDeclaration();
160
161 }