public class Loader
extends java.net.URLClassLoader
Modifier and Type | Class and Description |
---|---|
static class |
Loader.NondelegatingLoader
Version of bind-on-demand loader which will not delegate handling of
classes included in the binding definition.
|
Modifier and Type | Field and Description |
---|---|
private java.util.ArrayList |
m_bindings
Binding definitions used by loader.
|
private java.util.HashMap |
m_classMap
Map of classes modified by binding.
|
private boolean |
m_isBound
Flag for bindings compiled into class code.
|
Constructor and Description |
---|
Loader()
Default constructor.
|
Loader(java.net.URL[] paths)
Constructor with classpath URLs supplied.
|
Loader(java.net.URL[] paths,
java.lang.ClassLoader parent)
Constructor with classpath URLs and parent classloader supplied.
|
Modifier and Type | Method and Description |
---|---|
protected java.lang.Class |
findClass(java.lang.String name)
Find and load class by name.
|
static java.net.URL[] |
getClassPaths()
Method builds an array of URL for items in the class path.
|
protected boolean |
isBoundClass(java.lang.String name)
Check if a class has been modified by a binding.
|
void |
loadBinding(java.lang.String fname,
java.lang.String sname,
java.io.InputStream is,
java.net.URL url)
Load binding definition.
|
void |
loadFileBinding(java.lang.String path)
Load binding definition from file path.
|
void |
loadResourceBinding(java.lang.String path)
Load binding definition from file path.
|
void |
processBindings()
Process the binding definitions.
|
void |
reset()
Reset loader information.
|
addURL, close, definePackage, findResource, findResources, getPermissions, getProtectionDomainInternal, getResourceAsStream, getURLs, newInstance, newInstance
defineClass, defineClass, getProtectionDomain
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findSystemClass, getClassLoadingLock, getPackage, getPackages, getParent, getResource, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, loadClass, registerAsParallelCapable, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
private java.util.ArrayList m_bindings
private boolean m_isBound
private java.util.HashMap m_classMap
public Loader(java.net.URL[] paths, java.lang.ClassLoader parent)
paths
- array of classpath URLsparent
- classloader used for delegation loadingpublic Loader(java.net.URL[] paths)
paths
- array of classpath URLspublic Loader() throws java.net.MalformedURLException
java.net.MalformedURLException
- on error in classpath URLspublic void reset()
public static java.net.URL[] getClassPaths() throws java.net.MalformedURLException
java.net.MalformedURLException
public void loadBinding(java.lang.String fname, java.lang.String sname, java.io.InputStream is, java.net.URL url) throws JiBXException, java.io.IOException
fname
- binding definition full namesname
- short form of name to use as the default name of the bindingis
- input stream for binding definition documenturl
- URL for binding definition (null
if not
available)java.lang.IllegalStateException
- if called after bindings have been
compiledjava.io.IOException
- if error reading the bindingJiBXException
- if error in processing the binding definitionpublic void loadFileBinding(java.lang.String path) throws JiBXException, java.io.IOException
path
- binding definition file pathjava.lang.IllegalStateException
- if called after bindings have been
compiledjava.io.IOException
- if error reading the fileJiBXException
- if error in processing the binding definitionpublic void loadResourceBinding(java.lang.String path) throws JiBXException, java.io.IOException
path
- binding definition file pathjava.lang.IllegalStateException
- if called after bindings have been
compiledjava.io.IOException
- if error reading the fileJiBXException
- if error in processing the binding definitionpublic void processBindings() throws JiBXException
JiBXException
- if error in processing the binding definitionprotected boolean isBoundClass(java.lang.String name)
name
- fully qualified package and class name to be foundtrue
if class modified by binding,
false
if notprotected java.lang.Class findClass(java.lang.String name) throws java.lang.ClassNotFoundException
findClass
in class java.net.URLClassLoader
name
- fully qualified package and class name to be foundjava.lang.ClassNotFoundException
- if the class cannot be foundClassLoader.findClass(java.lang.String)