Java Class Load classForName(final String className)

Here you can find the source of classForName(final String className)

Description

class For Name

License

Open Source License

Declaration

public static <T> Class<T> classForName(final String className) 

Method Source Code

//package com.java2s;

public class Main {
    public static <T> Class<T> classForName(final String className) {
        return classForName(className, false);
    }/*w  w w .j  a va  2  s. co m*/

    @SuppressWarnings("unchecked")
    public static <T> Class<T> classForName(final String className, boolean ignoreException) {
        try {
            return (Class<T>) Class.forName(className);
        } catch (Error | Exception ex) {
            if (!ignoreException) {
                throw new Error("Error loading class: " + className, ex);
            }
        }
        return null;
    }
}

Related

  1. classForName(final String clsName)
  2. classForName(final String theClassName)
  3. classForName(String className)
  4. classForName(String className)