public class DynamicLoader extends Object
Modifier and Type | Field and Description |
---|---|
protected HashMap<String,Class> |
knownClasses |
Constructor and Description |
---|
DynamicLoader() |
Modifier and Type | Method and Description |
---|---|
Class |
getClass(String className,
PrintStream traceOut,
ClassLoader classLoader)
Load a class using the class name provided.
|
ClassLoader |
getClassLoader()
Get the ClassLoader supplied using the method
setClassLoader(java.lang.ClassLoader) . |
Object |
getInstance(String className,
ClassLoader classLoader)
Instantiate a class using the class name provided.
|
Object |
getInstance(String className,
PrintStream traceOut,
ClassLoader classLoader)
Instantiate a class using the class name provided, with the option of tracing
Note that the method does not check that the object is of the right class.
|
protected void |
registerKnownClasses()
Register classes that might be dynamically loaded even though they are contained
within Saxon itself.
|
void |
setClassLoader(ClassLoader loader)
Set a ClassLoader to be used when loading external classes.
|
protected void registerKnownClasses()
public void setClassLoader(ClassLoader loader)
loader
- the ClassLoader to be used in this configurationpublic ClassLoader getClassLoader()
setClassLoader(java.lang.ClassLoader)
.
If none has been supplied, return null.
public Class getClass(String className, PrintStream traceOut, ClassLoader classLoader) throws XPathException
This method is intended for internal use only.
className
- A string containing the name of the
class, for example "com.microstar.sax.LarkDriver"traceOut
- if diagnostic tracing is required, the destination for the output; otherwise nullclassLoader
- The ClassLoader to be used to load the class. If this is null, then
the classLoader used will be the first one available of: the classLoader registered
with the Configuration using setClassLoader(java.lang.ClassLoader)
; the context class loader for
the current thread; or failing that, the class loader invoked implicitly by a call
of Class.forName() (which is the ClassLoader that was used to load the Configuration
object itself).XPathException
- if the class cannot be loaded.public Object getInstance(String className, ClassLoader classLoader) throws XPathException
This method is intended for internal use only.
className
- A string containing the name of the
class, for example "com.microstar.sax.LarkDriver"classLoader
- The ClassLoader to be used to load the class. If this is null, then
the classLoader used will be the first one available of: the classLoader registered
with the Configuration using setClassLoader(java.lang.ClassLoader)
; the context class loader for
the current thread; or failing that, the class loader invoked implicitly by a call
of Class.forName() (which is the ClassLoader that was used to load the Configuration
object itself).XPathException
- if the class cannot be loaded.public Object getInstance(String className, PrintStream traceOut, ClassLoader classLoader) throws XPathException
This method is intended for internal use only.
className
- A string containing the name of the
class, for example "com.microstar.sax.LarkDriver"traceOut
- if attempts to load classes are to be traced, then the destination
for the trace output; otherwise nullclassLoader
- The ClassLoader to be used to load the class. If this is null, then
the classLoader used will be the first one available of: the classLoader registered
with the Configuration using setClassLoader(java.lang.ClassLoader)
; the context class loader for
the current thread; or failing that, the class loader invoked implicitly by a call
of Class.forName() (which is the ClassLoader that was used to load the Configuration
object itself).XPathException
- if the class cannot be loaded.Copyright (c) 2004-2013 Saxonica Limited. All rights reserved.