Package javassist
Class ClassClassPath
java.lang.Object
javassist.ClassClassPath
- All Implemented Interfaces:
ClassPath
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.
Class files in a named module are private to that module. This method cannot obtain class files in named modules.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionObtains the URL of the specified class file.openClassfile
(String classname) Obtains a class file bygetResourceAsStream()
.toString()
-
Constructor Details
-
ClassClassPath
Creates a search path.- Parameters:
c
- theClass
object used to obtain a class file.getResourceAsStream()
is called on this object.
-
-
Method Details
-
openClassfile
Obtains a class file bygetResourceAsStream()
.- Specified by:
openClassfile
in interfaceClassPath
- Parameters:
classname
- a fully-qualified class name- Returns:
- the input stream for reading a class file
- Throws:
NotFoundException
- See Also:
-
find
Obtains the URL of the specified class file. -
toString
-