|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectkoala.dynamicjava.util.ImportationManager
The instances of this class manages the importation clauses.
The declarePackageImport
method imports a new package.
This one has the highest priority over the imported packages when a
lookup is made to find a class.
The declareClassImport
method imports a new class. This
one has the highest priority over the same suffix imported class.
Field Summary | |
protected java.lang.ClassLoader |
classLoader
The class loader that must be used |
protected java.lang.String |
currentPackage
This string contains the name of the current package |
protected java.util.List |
importOnDemandClauses
This list contains the import-on-demand clauses. |
protected java.util.List |
singleTypeImportClauses
This set contains the single-type-import clauses. |
Constructor Summary | |
|
ImportationManager(java.lang.ClassLoader cl)
Creates a new importation manager. |
protected |
ImportationManager(ImportationManager im)
Copy constructor |
Method Summary | |
java.lang.Object |
clone()
Returns a copy of this object |
void |
declareClassImport(java.lang.String cname)
Declares a new single-type-import clause |
void |
declarePackageImport(java.lang.String pkg)
Declares a new import-on-demand clause |
protected java.lang.Class |
findInnerClass(java.lang.String s)
Searches for an inner class from its name in the dotted notation |
java.lang.String |
getCurrentPackage()
Returns the current package |
java.util.List |
getImportOnDemandClauses()
Returns the import-on-demand clauses |
protected java.util.List |
getOuterNames(java.lang.String cname)
Returns a list of the outer classes names |
java.util.List |
getSingleTypeImportClauses()
Returns the single-type-import clauses |
protected boolean |
hasSuffix(java.lang.String c1,
java.lang.String c2)
Tests whether the fully qualified class name c1 ends with c2 |
java.lang.Class |
lookupClass(java.lang.String cname,
java.lang.String ccname)
Loads the class that match to the given name in the source file |
void |
setClassLoader(java.lang.ClassLoader cl)
Sets the class loader |
void |
setCurrentPackage(java.lang.String pkg)
Sets the current package. |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected java.util.List importOnDemandClauses
protected java.util.List singleTypeImportClauses
protected java.lang.String currentPackage
protected java.lang.ClassLoader classLoader
Constructor Detail |
public ImportationManager(java.lang.ClassLoader cl)
cl
- the class loader to useprotected ImportationManager(ImportationManager im)
Method Detail |
public java.lang.Object clone()
public void setClassLoader(java.lang.ClassLoader cl)
public void setCurrentPackage(java.lang.String pkg)
lookupClass
method.
pkg
- the package namepublic java.lang.String getCurrentPackage()
public java.util.List getImportOnDemandClauses()
public java.util.List getSingleTypeImportClauses()
public void declarePackageImport(java.lang.String pkg)
pkg
- the package namepublic void declareClassImport(java.lang.String cname) throws java.lang.ClassNotFoundException
cname
- the fully qualified class name
java.lang.ClassNotFoundException
- if the class cannot be foundpublic java.lang.Class lookupClass(java.lang.String cname, java.lang.String ccname) throws java.lang.ClassNotFoundException
cname
- the name of the class to findccname
- the name of the current class or null
java.lang.ClassNotFoundException
- if the class cannot be loadedprotected java.util.List getOuterNames(java.lang.String cname)
protected java.lang.Class findInnerClass(java.lang.String s) throws java.lang.ClassNotFoundException
java.lang.ClassNotFoundException
protected boolean hasSuffix(java.lang.String c1, java.lang.String c2)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |