org.linkedin.util-core/src/main/java/org/linkedin/util/reflect/ReflectUtils.java
public static Class forName(Class clazz, ClassLoader classLoader)
    throws ClassNotFoundException, LinkageError
  {
    if(clazz == null)
      return null;

    if(classLoader == null)
    {
      classLoader = getDefaultClassLoader();
    }

    if(clazz.getClassLoader() == null || clazz.getClassLoader().equals(classLoader))
      return clazz;
    else
      return forName(clazz.getName(), classLoader);
  }
public static Class forName(Class clazz, ClassLoader classLoader)
    throws ClassNotFoundException, LinkageError
  {
    if(clazz == null)
      return null;

    if(classLoader == null)
    {
      classLoader = getDefaultClassLoader();
    }

    if(clazz.getClassLoader() == null || clazz.getClassLoader().equals(classLoader))
      return clazz;
    else
      return forName(clazz.getName(), classLoader);
  }
public static Class forName ( Class clazz , ClassLoader classLoader ) throws ClassNotFoundException , LinkageError { if ( clazz == null ) return null ; if ( classLoader == null ) { classLoader = getDefaultClassLoader ( ) ; } if ( clazz . getClassLoader ( ) == null || clazz . getClassLoader ( ) . equals ( classLoader ) ) return clazz ; else return forName ( clazz . getName ( ) , classLoader ) ; }
Convenient call to return a class in a different class loader... note that it will handle
correctly a class in the same class loader

@param clazz       the clazz you want in a different class loader
@param classLoader the class loader to use (may be <code>null</code>, which indicates the
default class loader)
@return Class instance for the supplied name
@throws ClassNotFoundException if the class was not found
@throws LinkageError           if the class file could not be loaded
@see Class#forName(String, boolean, ClassLoader)
Convenient call to return a class in a different class loader ... note that it will handle correctly a class in the same class loader