|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object polyglot.types.ClassResolver polyglot.types.ImportTable
public class ImportTable
An ImportTable
is a type of ClassResolver
that
corresponds to a particular source file.
It has a set of package and class imports, which caches the results of lookups for future reference.
Field Summary | |
---|---|
protected java.util.List |
classImports
List of explicitly imported classes added to the table or pending in the lazyImports list. |
protected java.util.List |
lazyImports
List of class imports which will be lazily added to the table at the next lookup. |
protected java.util.Map |
map
Map from names to classes found, or to the NOT_FOUND object. |
protected java.util.List |
packageImports
A list of all package imports. |
protected Package |
pkg
Our package |
protected Resolver |
resolver
The underlying resolver. |
protected java.lang.String |
sourceName
Source name to use for debugging and error reporting |
protected Position |
sourcePos
Position to use for error reporting |
protected TypeSystem |
ts
|
Constructor Summary | |
---|---|
ImportTable(TypeSystem ts,
Resolver base,
Package pkg)
Create an import table. |
|
ImportTable(TypeSystem ts,
Resolver base,
Package pkg,
java.lang.String src)
Create an import table. |
Method Summary | |
---|---|
void |
addClassImport(java.lang.String className)
Add a class import. |
void |
addPackageImport(java.lang.String pkgName)
Add a package import. |
protected Named |
cachedFind(java.lang.String name)
Find a type by name, using the cache and the outer resolver, but not the import table. |
java.util.List |
classImports()
List the classes explicitly imported. |
Named |
find(java.lang.String name)
Find a type by name, searching the import table. |
protected Named |
findInPkg(java.lang.String name,
java.lang.String pkgName)
|
protected boolean |
isVisibleFrom(Named n,
java.lang.String pkgName)
Return whether n in package pkgName is visible from within
package pkg . |
protected void |
lazyImport()
Load the class imports, lazily. |
Package |
package_()
The package of the source we are importing types into. |
java.util.List |
packageImports()
List the packages we import from. |
java.lang.String |
sourceName()
The name of the source file we are importing into. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected TypeSystem ts
protected Resolver resolver
protected java.util.List packageImports
protected java.util.Map map
protected java.util.List lazyImports
protected java.util.List classImports
protected java.lang.String sourceName
protected Position sourcePos
protected Package pkg
Constructor Detail |
---|
public ImportTable(TypeSystem ts, Resolver base, Package pkg)
ts
- The type systembase
- The outermost resolver to use for looking up types.pkg
- The package of the source we are importing types into.public ImportTable(TypeSystem ts, Resolver base, Package pkg, java.lang.String src)
ts
- The type systembase
- The outermost resolver to use for looking up types.pkg
- The package of the source we are importing types into.src
- The name of the source file we are importing into.Method Detail |
---|
public Package package_()
public void addClassImport(java.lang.String className)
public void addPackageImport(java.lang.String pkgName)
public java.util.List packageImports()
public java.util.List classImports()
public java.lang.String sourceName()
protected Named cachedFind(java.lang.String name) throws SemanticException
SemanticException
public Named find(java.lang.String name) throws SemanticException
find
in interface Resolver
find
in class ClassResolver
SemanticException
protected Named findInPkg(java.lang.String name, java.lang.String pkgName) throws SemanticException
SemanticException
protected boolean isVisibleFrom(Named n, java.lang.String pkgName)
n
in package pkgName
is visible from within
package pkg
. The empty string may
be passed in to represent the default package.
protected void lazyImport() throws SemanticException
SemanticException
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |