public class ClassLoaderBuilder
extends java.lang.Object
Constructor and Description |
---|
ClassLoaderBuilder()
Create a new ClassLoaderBuilder.
|
Modifier and Type | Method and Description |
---|---|
int |
add(java.util.Collection<java.io.File> files)
Add a Collection of jar files, zip files or directories to
the list of places the not-yet-constructed class loader will search.
|
boolean |
add(java.io.File file)
Add a jar file, zip file or directory to the list of places the
not-yet-constructed class loader will search.
|
int |
add(java.io.File[] files)
Add an array of jar files, zip files or directories to the list of
places the not-yet-constructed class loader will search.
|
void |
addClassPath()
Add the contents of the classpath.
|
void |
clear()
Clear the stored files in this object.
|
java.lang.ClassLoader |
createClassLoader()
Create and return a class loader that will search the additional
places defined in this builder.
|
java.lang.ClassLoader |
createClassLoader(java.lang.ClassLoader parentLoader)
Create and return a class loader that will search the additional
places defined in this builder.
|
public boolean add(java.io.File file)
file
- the jar file, zip file or directorypublic int add(java.io.File[] files)
files
- the arraypublic int add(java.util.Collection<java.io.File> files)
files
- the collectionpublic void addClassPath()
public void clear()
public java.lang.ClassLoader createClassLoader() throws java.lang.SecurityException
java.lang.SecurityException
- if a security manager exists and its
checkCreateClassLoader() method
does not allow creation of a class loaderpublic java.lang.ClassLoader createClassLoader(java.lang.ClassLoader parentLoader) throws java.lang.SecurityException
parentLoader
- the desired parent class loaderjava.lang.SecurityException
- if a security manager exists and its
checkCreateClassLoader() method
does not allow creation of a class loader