org.zodiac.script.engine.java.DynamicClassLoader Maven / Gradle / Ivy
package org.zodiac.script.engine.java;
import java.net.URL;
import java.net.URLClassLoader;
public class DynamicClassLoader extends URLClassLoader {
public ClassLoader parent;
public DynamicClassLoader(ClassLoader parent) {
this(new URL[0], parent);
}
public DynamicClassLoader(URL[] urls, ClassLoader parent) {
super(urls, parent);
this.parent = parent;
}
@Override
public Class> loadClass(String name) throws ClassNotFoundException {
return super.loadClass(name);
}
@Override
public Class> loadClass(String name, boolean resolve) throws ClassNotFoundException {
return super.loadClass(name, resolve);
}
public Class> findClassByClassName(String className) throws ClassNotFoundException {
return this.findClass(className);
}
public Class> loadClass(String fullName, JavaClassObject jco) {
byte[] classData = jco.getBytes();
return this.defineClass(fullName, classData, 0, classData.length);
}
}