public class DynamicClassLoader
extends java.lang.ClassLoader
Title: Dynamic class loader
Description: Dynamically load classes
Copyright: Copyright (c) 2004-2014, David Read
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Modifier and Type | Field and Description |
---|---|
private java.util.Map<java.lang.String,java.lang.Class<?>> |
cachedClasses
Cache of loaded classes
|
private java.net.URLClassLoader |
classLoader
URL class loader instance
|
private static org.apache.log4j.Logger |
LOGGER
Logger
|
Constructor and Description |
---|
DynamicClassLoader(java.util.List<java.io.File> archives)
Create a DynamicClassLoader instance from a list of file paths
|
Modifier and Type | Method and Description |
---|---|
java.lang.Class<?> |
loadClass(java.lang.String className) |
java.lang.Class<?> |
loadClass(java.lang.String className,
boolean resolveIt) |
void |
setupClassLoader(java.util.List<java.io.File> archives)
Add the files to the class loader
|
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findResources, findSystemClass, getClassLoadingLock, getPackage, getPackages, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, registerAsParallelCapable, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
private static final org.apache.log4j.Logger LOGGER
private java.util.Map<java.lang.String,java.lang.Class<?>> cachedClasses
private java.net.URLClassLoader classLoader
public DynamicClassLoader(java.util.List<java.io.File> archives)
archives
- A list of file pathspublic void setupClassLoader(java.util.List<java.io.File> archives)
archives
- The list of file paths to class librariespublic java.lang.Class<?> loadClass(java.lang.String className) throws java.lang.ClassNotFoundException
loadClass
in class java.lang.ClassLoader
java.lang.ClassNotFoundException
public java.lang.Class<?> loadClass(java.lang.String className, boolean resolveIt) throws java.lang.ClassNotFoundException
loadClass
in class java.lang.ClassLoader
java.lang.ClassNotFoundException