org.jboss.ejb3.common.classloader.util
Class PrimitiveClassLoadingUtil

java.lang.Object
  extended by org.jboss.ejb3.common.classloader.util.PrimitiveClassLoadingUtil

public class PrimitiveClassLoadingUtil
extends java.lang.Object

PrimitiveClassLoadingUtil Util for centralizing the logic for handling primitive types during classloading. Use the loadClass(String, ClassLoader) to centralize the logic of checking for primitive types to ensure that the ClassLoader.loadClass(String) method is not invoked for primitives.


Constructor Summary
PrimitiveClassLoadingUtil()
           
 
Method Summary
static java.lang.Class<?> loadClass(java.lang.String name, java.lang.ClassLoader cl)
          First checks if name is a primitive type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PrimitiveClassLoadingUtil

public PrimitiveClassLoadingUtil()
Method Detail

loadClass

public static java.lang.Class<?> loadClass(java.lang.String name,
                                           java.lang.ClassLoader cl)
                                    throws java.lang.ClassNotFoundException
First checks if name is a primitive type. If yes, then returns the corresponding Class for that primitive. If it's not a primitive then the Class.forName(String, boolean, ClassLoader) method is invoked, passing it the name, false and the cl classloader Note that we intentionally use Class.forName(name,boolean,cl) to handle issues with loading array types in Java 6 http://bugs.sun.com/view_bug.do?bug_id=6434149

Parameters:
name - The class that has to be loaded
cl - The ClassLoader to use, if name is *not* a primitive
Returns:
Returns the Class corresponding to name
Throws:
java.lang.ClassNotFoundException - If the class for name could not be found
See Also:
ClassLoader.loadClass(String)