KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > compiler > env > INameEnvironment


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 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 package org.eclipse.jdt.internal.compiler.env;
12
13 /**
14  * The name environment provides a callback API that the compiler
15  * can use to look up types, compilation units, and packages in the
16  * current environment. The name environment is passed to the compiler
17  * on creation.
18  */

19 public interface INameEnvironment {
20 /**
21  * Find a type with the given compound name.
22  * Answer the binary form of the type if it is known to be consistent.
23  * Otherwise, answer the compilation unit which defines the type
24  * or null if the type does not exist.
25  * Types in the default package are specified as {{typeName}}.
26  *
27  * It is unknown whether the package containing the type actually exists.
28  *
29  * NOTE: This method can be used to find a member type using its
30  * internal name A$B, but the source file for A is answered if the binary
31  * file is inconsistent.
32  */

33
34 NameEnvironmentAnswer findType(char[][] compoundTypeName);
35 /**
36  * Find a type named <typeName> in the package <packageName>.
37  * Answer the binary form of the type if it is known to be consistent.
38  * Otherwise, answer the compilation unit which defines the type
39  * or null if the type does not exist.
40  * The default package is indicated by char[0][].
41  *
42  * It is known that the package containing the type exists.
43  *
44  * NOTE: This method can be used to find a member type using its
45  * internal name A$B, but the source file for A is answered if the binary
46  * file is inconsistent.
47  */

48
49 NameEnvironmentAnswer findType(char[] typeName, char[][] packageName);
50 /**
51  * Answer whether packageName is the name of a known subpackage inside
52  * the package parentPackageName. A top level package is found relative to null.
53  * The default package is always assumed to exist.
54  *
55  * For example:
56  * isPackage({{java}, {awt}}, {event});
57  * isPackage(null, {java});
58  */

59
60 boolean isPackage(char[][] parentPackageName, char[] packageName);
61
62 /**
63  * This method cleans the environment uo. It is responsible for releasing the memory
64  * and freeing resources. Passed that point, the name environment is no longer usable.
65  *
66  * A name environment can have a long life cycle, therefore it is the responsibility of
67  * the code which created it to decide when it is a good time to clean it up.
68  */

69 void cleanup();
70
71 }
72
Popular Tags