org.apache.sling.jcr.ocm.impl.classloader
Class MapperClassLoader
java.lang.Object
java.lang.ClassLoader
org.apache.sling.jcr.ocm.impl.classloader.MapperClassLoader
public class MapperClassLoader
- extends ClassLoader
The MapperClassLoader
is a very limited class loader which is
able to load registered classes only. Classes are registered in or two
ways:
- Using the
java.lang.Class
object. In this case, the
loadClass(String, boolean)
method just returns that class object.
- Using a
java.lang.ClassLoader
and the fully qualified className
of the class. In this case, the loadClass(String, boolean)
method will call the ClassLoader.loadClass(String)
method of
the given class loader with the supplied class className.
Instances of this class loader have no parent class loader.
Constructor Summary |
MapperClassLoader()
Creates an instance of this class loader without a parent class loader. |
Methods inherited from class java.lang.ClassLoader |
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findResources, findSystemClass, getPackage, getPackages, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MapperClassLoader
public MapperClassLoader()
- Creates an instance of this class loader without a parent class loader.
dispose
public void dispose()
registerClass
public void registerClass(String className,
ClassLoader classLoader)
registerClass
public void registerClass(String className,
org.osgi.framework.Bundle bundle)
unregisterClass
public void unregisterClass(String className)
registerClassLoader
public void registerClassLoader(ClassLoader classLoader)
unregisterClassLoader
public void unregisterClassLoader(ClassLoader classLoader)
registerBundle
public void registerBundle(org.osgi.framework.Bundle bundle)
unregisterBundle
public void unregisterBundle(org.osgi.framework.Bundle bundle)
loadClass
protected Class loadClass(String name,
boolean resolve)
throws ClassNotFoundException
- Returns the
Class
object for the given fully qualified
class className. If no class, with the given className has been registered with
the #registerClass(Class)
or
registerClass(String, ClassLoader)
method, the boot class loader
is asked for the class, which will most certainly fail.
- Overrides:
loadClass
in class ClassLoader
- Parameters:
className
- The fully qualified className of the class.resolve
- Whether or not to resolve the class. This parameter is
not used by this implementation
- Returns:
- The class for the className
- Throws:
ClassNotFoundException
- If the given class cannot be returned.
Copyright © 2007-2013 The Apache Software Foundation. All Rights Reserved.