public final class HotCodeLoader
extends java.lang.Object
Constructor and Description |
---|
HotCodeLoader() |
HotCodeLoader(java.lang.ClassLoader parentClassLoader) |
HotCodeLoader(java.lang.String compileClasspath,
java.lang.ClassLoader parentClassLoader) |
Modifier and Type | Method and Description |
---|---|
boolean |
addSourceDir(java.io.File srcDir)
Add a directory that contains the source of dynamic java code.
|
java.net.URL |
getResource(java.lang.String resource)
Get a resource from added source directories.
|
java.io.InputStream |
getResourceAsStream(java.lang.String resource)
Get a resource stream from added source directories.
|
java.lang.Class |
loadClass(java.lang.String className)
Returns the up-to-date dynamic class by name.
|
java.lang.Object |
newProxyInstance(java.lang.Class interfaceClass,
java.lang.String implClassName)
Create a proxy instance that implements the specified access interface
and delegates incoming invocations to the specified dynamic
implementation.
|
public HotCodeLoader()
public HotCodeLoader(java.lang.ClassLoader parentClassLoader)
public HotCodeLoader(java.lang.String compileClasspath, java.lang.ClassLoader parentClassLoader)
compileClasspath
- used to compile dynamic classesparentClassLoader
- the parent of the class loader that loads all the dynamic
classespublic boolean addSourceDir(java.io.File srcDir)
srcDir
- public java.lang.Class loadClass(java.lang.String className) throws java.lang.ClassNotFoundException
className
- java.lang.ClassNotFoundException
- if source file not found or compilation errorpublic java.net.URL getResource(java.lang.String resource)
resource
- public java.io.InputStream getResourceAsStream(java.lang.String resource)
resource
- public java.lang.Object newProxyInstance(java.lang.Class interfaceClass, java.lang.String implClassName) throws java.lang.RuntimeException
interfaceClass
- the access interfaceimplClassName
- the backend dynamic implementationjava.lang.RuntimeException
- if an instance cannot be created, because of class not found
for exampleCopyright © 2019 by Sucang.cn