KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > source > tree > Scope


1 /*
2  * @(#)Scope.java 1.1 06/06/24
3  *
4  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  *
7  * Use and Distribution is subject to the Java Research License available
8  * at <http://wwws.sun.com/software/communitysource/jrl.html>.
9  */

10
11 package com.sun.source.tree;
12
13 import com.sun.source.tree.Tree;
14 import javax.lang.model.element.Element;
15 import javax.lang.model.element.ExecutableElement;
16 import javax.lang.model.element.TypeElement;
17 import javax.lang.model.type.DeclaredType;
18
19 /**
20  * Interface for determining locally available program elements, such as
21  * local variables and imports.
22  * Upon creation, a Scope is associated with a given program position;
23  * for example, a {@linkplain Tree tree node}. This position may be used to
24  * infer an enclosing method and/or class.
25  *
26  * <p>A Scope does not itself contain the details of the elements corresponding
27  * to the parameters, methods and fields of the methods and classes containing
28  * its position. However, these elements can be determined from the enclosing
29  * elements.
30  *
31  * <p>Scopes may be contained in an enclosing scope. The outermost scope contains
32  * those elements available via "star import" declarations; the scope within that
33  * contains the top level elements of the compilation unit, including any named
34  * imports.
35  *
36  * @since 1.6
37  */

38 public interface Scope {
39     /**
40      * Returns the enclosing scope.
41      */

42     public Scope getEnclosingScope();
43     
44     /**
45      * Returns the innermost type element containing the position of this scope
46      */

47     public TypeElement getEnclosingClass();
48     
49     /**
50      * Returns the innermost executable element containing the position of this scope.
51      */

52     public ExecutableElement getEnclosingMethod();
53     
54     /**
55      * Returns the elements directly contained in this scope.
56      */

57     public Iterable JavaDoc<? extends Element> getLocalElements();
58 }
59
Popular Tags