|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjavassist.ClassClassPath
public class ClassClassPath
A search-path for obtaining a class file
by getResourceAsStream() in java.lang.Class.
Try adding a ClassClassPath when a program is running
with a user-defined class loader and any class files are not found with
the default ClassPool. For example,
ClassPool cp = ClassPool.getDefault(); cp.insertClassPath(new ClassClassPath(this.getClass()));This code snippet permanently adds a
ClassClassPath
to the default ClassPool. Note that the default
ClassPool is a singleton. The added
ClassClassPath uses a class object representing
the class including the code snippet above.
ClassPool.insertClassPath(ClassPath),
ClassPool.appendClassPath(ClassPath),
LoaderClassPath| Constructor Summary | |
|---|---|
ClassClassPath(java.lang.Class c)
Creates a search path. |
|
| Method Summary | |
|---|---|
void |
close()
Does nothing. |
java.net.URL |
find(java.lang.String classname)
Obtains the URL of the specified class file. |
java.io.InputStream |
openClassfile(java.lang.String classname)
Obtains a class file by getResourceAsStream(). |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public ClassClassPath(java.lang.Class c)
c - the Class object used to obtain a class
file. getResourceAsStream() is called on
this object.| Method Detail |
|---|
public java.io.InputStream openClassfile(java.lang.String classname)
getResourceAsStream().
openClassfile in interface ClassPathclassname - a fully-qualified class name
Translatorpublic java.net.URL find(java.lang.String classname)
find in interface ClassPathclassname - a fully-qualified class name.
public void close()
close in interface ClassPathpublic 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 | ||||||||