org.jboss.ejb3.common.classloader
Class PrimitiveAwareClassLoader

java.lang.Object
  extended by java.lang.ClassLoader
      extended by org.jboss.ejb3.common.classloader.PrimitiveAwareClassLoader

public class PrimitiveAwareClassLoader
extends ClassLoader

PrimitiveAwareClassLoader This is more of a hack to avoid checking for primitives at multiple places while loading a class from a name.
The PrimitiveAwareClassLoader will first check whether the request is to load a primitive. If it's a primitive then it returns back the appropriate Class corresponding to the primitive. For all other requests, it redirects the request to the parent classloader.

Version:
$Revision: $
Author:
Jaikiran Pai

Constructor Summary
PrimitiveAwareClassLoader(ClassLoader parent)
           
 
Method Summary
protected  Class<?> findClass(String name)
          As recommended in ClassLoader.findClass(java.lang.String), the findClass method should be overriden by the custom classloaders.
 
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findResource, findResources, findSystemClass, getPackage, getPackages, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, loadClass, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PrimitiveAwareClassLoader

public PrimitiveAwareClassLoader(ClassLoader parent)
Parameters:
parent - Parent classloader
Method Detail

findClass

protected Class<?> findClass(String name)
                      throws ClassNotFoundException
As recommended in ClassLoader.findClass(java.lang.String), the findClass method should be overriden by the custom classloaders. This method will first check whether the requested name is a primitive. If yes, it returns the appropriate Class for the primitive. If not, then it lets the parent handle it.

Overrides:
findClass in class ClassLoader
Throws:
ClassNotFoundException


Copyright © 2009 JBoss, a division of Red Hat, Inc.. All Rights Reserved.