Package javassist
Class LoaderClassPath
- java.lang.Object
-
- javassist.LoaderClassPath
-
- All Implemented Interfaces:
ClassPath
public class LoaderClassPath extends java.lang.Object implements ClassPath
A class search-path representing a class loader.It is used for obtaining a class file from the given class loader by
getResourceAsStream(). TheLoaderClassPathrefers to the class loader throughWeakReference. If the class loader is garbage collected, the other search pathes are examined.The given class loader must have both
getResourceAsStream()andgetResource().Class files in a named module are private to that module. This method cannot obtain class files in named modules.
- Author:
- Bill Burke, Shigeru Chiba
- See Also:
ClassPool.insertClassPath(ClassPath),ClassPool.appendClassPath(ClassPath),ClassClassPath
-
-
Constructor Summary
Constructors Constructor Description LoaderClassPath(java.lang.ClassLoader cl)Creates a search path representing a class loader.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.net.URLfind(java.lang.String classname)Obtains the URL of the specified class file.java.io.InputStreamopenClassfile(java.lang.String classname)Obtains a class file from the class loader.java.lang.StringtoString()
-
-
-
Method Detail
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
openClassfile
public java.io.InputStream openClassfile(java.lang.String classname) throws NotFoundExceptionObtains a class file from the class loader. This method callsgetResourceAsStream(String)on the class loader.- Specified by:
openClassfilein interfaceClassPath- Parameters:
classname- a fully-qualified class name- Returns:
- the input stream for reading a class file
- Throws:
NotFoundException- See Also:
Translator
-
find
public java.net.URL find(java.lang.String classname)
Obtains the URL of the specified class file. This method callsgetResource(String)on the class loader.
-
-