Java Class Load loadClass(Class sourceClass, final String className)

Here you can find the source of loadClass(Class sourceClass, final String className)

Description

load Class

License

Open Source License

Declaration

public static Class loadClass(Class sourceClass, final String className) 

Method Source Code

//package com.java2s;

public class Main {
    public static Class loadClass(Class sourceClass, final String className) {
        try {/*from www.j  a v a 2 s.  com*/
            ClassLoader loader = sourceClass.getClassLoader();

            if (loader != null) {
                return loader.loadClass(className);
            } else {
                return (Class) Class.forName(className);
            }
        } catch (ClassNotFoundException e) {
            // ignore - maybe log?
        }

        return null;
    }
}

Related

  1. getClassHierarchyLeaf( Collection> classes)
  2. getClassName(String logicalName, String trailingName)
  3. getClassNameRepresentation(String name)
  4. getClassNames( StackTraceElement[] currentStack)
  5. loadClass(Class context, String... names)
  6. loadClass(Class base, String name)
  7. loadClass(Class clazz)
  8. loadClass(Class contextClass, String className)
  9. loadClass(ClassLoader classLoader, Class clazz, String postfix)