src/main/java/org/jboss/util/Classes.java
/**
    * This method acts equivalently to invoking classLoader.loadClass(className)
    * but it also supports primitive types and array classes of object types or
    * primitive types.
    *
    * @param className the qualified name of the class or the name of primitive
    * type or array in the same format as returned by the
    * java.lang.Class.getName() method.
    * @param classLoader  the ClassLoader used to load classes
    * @return             the Class object for the requested className
    *
    * @throws ClassNotFoundException when the <code>classLoader</code> can not
    * find the requested class
    */
This method acts equivalently to invoking classLoader.loadClass(className)
but it also supports primitive types and array classes of object types or
primitive types.

@param className the qualified name of the class or the name of primitive
type or array in the same format as returned by the
java.lang.Class.getName() method.
@param classLoader  the ClassLoader used to load classes
@return             the Class object for the requested className

@throws ClassNotFoundException when the classLoader can not
find the requested class
This method acts equivalently to invoking classLoader . loadClass ( className ) but it also supports primitive types and array classes of object types or primitive types . @param className the qualified name of the class or the name of primitive type or array in the same format as returned by the java . lang . Class . getName () method . @param classLoader the ClassLoader used to load classes @return the Class object for the requested className @throws ClassNotFoundException when the classLoader can not find the requested class
public static Class loadClass(String className, ClassLoader classLoader)
      throws ClassNotFoundException
   {
         B            byte
         C            char
         D            double
         F            float
         I            int
         J            long
         S            short
         Z            boolean
         V	         void
      if (className.length() == 1)
      {
         char type = className.charAt(0);
         if (type == 'B') return Byte.TYPE;
         if (type == 'C') return Character.TYPE;
         if (type == 'D') return Double.TYPE;
         if (type == 'F') return Float.TYPE;
         if (type == 'I') return Integer.TYPE;
         if (type == 'J') return Long.TYPE;
         if (type == 'S') return Short.TYPE;
         if (type == 'Z') return Boolean.TYPE;
         if (type == 'V') return Void.TYPE;
          else throw...
         throw new ClassNotFoundException(className);
      }
       Check for a primative type
      if( isPrimitive(className) == true )
         return (Class) Classes.PRIMITIVE_NAME_TYPE_MAP.get(className);
       Check for the internal vm format: Lclassname;
      if (className.charAt(0) == 'L' && className.charAt(className.length() - 1) == ';')
         return classLoader.loadClass(className.substring(1, className.length() - 1));
       first try - be optimistic
       this will succeed for all non-array classes and array classes that have already been resolved
      try
      {
         return classLoader.loadClass(className);
      }
      catch (ClassNotFoundException e)
      {
          if it was non-array class then throw it
         if (className.charAt(0) != '[')
            throw e;
      }
       we are now resolving array class for the first time
       count opening braces
      int arrayDimension = 0;
      while (className.charAt(arrayDimension) == '[')
         arrayDimension++;
       resolve component type - use recursion so that we can resolve primitive types also
      Class componentType = loadClass(className.substring(arrayDimension), classLoader);
       construct array class
      return Array.newInstance(componentType, new int[arrayDimension]).getClass();
   }
public static Class loadClass ( String className , ClassLoader classLoader ) throws ClassNotFoundException { if ( className . length ( ) == 1 ) { char type = className . charAt ( 0 ) ; if ( type == 'B' ) return Byte . TYPE ; if ( type == 'C' ) return Character . TYPE ; if ( type == 'D' ) return Double . TYPE ; if ( type == 'F' ) return Float . TYPE ; if ( type == 'I' ) return Integer . TYPE ; if ( type == 'J' ) return Long . TYPE ; if ( type == 'S' ) return Short . TYPE ; if ( type == 'Z' ) return Boolean . TYPE ; if ( type == 'V' ) return Void . TYPE ; throw new ClassNotFoundException ( className ) ; } if ( isPrimitive ( className ) == true ) return ( Class ) Classes . PRIMITIVE_NAME_TYPE_MAP . get ( className ) ; if ( className . charAt ( 0 ) == 'L' && className . charAt ( className . length ( ) - 1 ) == ';' ) return classLoader . loadClass ( className . substring ( 1 , className . length ( ) - 1 ) ) ; try { return classLoader . loadClass ( className ) ; } catch ( ClassNotFoundException e ) { if ( className . charAt ( 0 ) != '[' ) throw e ; } int arrayDimension = 0 ; while ( className . charAt ( arrayDimension ) == '[' ) arrayDimension ++ ; Class componentType = loadClass ( className . substring ( arrayDimension ) , classLoader ) ; return Array . newInstance ( componentType , new int [ arrayDimension ] ) . getClass ( ) ; }
This method acts equivalently to invoking classLoader.loadClass(className)
 but it also supports primitive types and array classes of object types or
 primitive types.
This method acts equivalently to invoking classLoader . loadClass ( className ) but it also supports primitive types and array classes of object types or primitive types .
// ClassLoader.loadClass() does not handle primitive types: // //   B            byte //   C            char //   D            double //   F            float //   I            int //   J            long //   S            short //   Z            boolean //   V	         void // // else throw... // Check for a primative type // Check for the internal vm format: Lclassname; // first try - be optimistic // this will succeed for all non-array classes and array classes that have already been resolved // // if it was non-array class then throw it // we are now resolving array class for the first time // count opening braces // resolve component type - use recursion so that we can resolve primitive types also // construct array class