/** * Get the Class from the class name. * <p> * The context class loader will be utilized if accessible and non-null. * Otherwise the defining class loader of this class will * be utilized. * * @param name the class name. * @return the Class, otherwise null if the class cannot be found. */ public static Class classForName(String name) { return classForName(name, getContextClassLoader()); }
/** * Get the Class from the class name. * <p> * The context class loader will be utilized if accessible and non-null. * Otherwise the defining class loader of this class will * be utilized. * * @param name the class name. * @return the Class, otherwise null if the class cannot be found. */ public static Class classForName(String name) { return classForName(name, getContextClassLoader()); }
/** * Get the Class from the class name. * <p> * The context class loader will be utilized if accessible and non-null. * Otherwise the defining class loader of this class will * be utilized. * * @param name the class name. * @return the Class, otherwise null if the class cannot be found. * @throws ClassNotFoundException if the class cannot be found. */ public static Class classForNameWithException(String name) throws ClassNotFoundException { return classForNameWithException(name, getContextClassLoader()); }
/** * Get the Class from the class name. * <p> * The context class loader will be utilized if accessible and non-null. * Otherwise the defining class loader of this class will * be utilized. * * @param name the class name. * @return the Class, otherwise null if the class cannot be found. * @throws ClassNotFoundException if the class cannot be found. */ public static Class classForNameWithException(String name) throws ClassNotFoundException { return classForNameWithException(name, getContextClassLoader()); }
/** * Get privileged exception action to obtain Class from given class name. * If run using security manager, the returned privileged exception action * must be invoked within a doPrivileged block. * <p> * The actual context class loader will be utilized if accessible and non-null. * Otherwise the defining class loader of the calling class will be utilized. * * @param <T> class type. * @param name class name. * @return privileged exception action to obtain the Class. * The action could throw {@link ClassNotFoundException} or return {@code null} if the class cannot be found. * @throws ClassNotFoundException when provided string contains classname of unknown class. * @see AccessController#doPrivileged(java.security.PrivilegedExceptionAction) */ public static <T> PrivilegedExceptionAction<Class<T>> classForNameWithExceptionPEA(final String name) throws ClassNotFoundException { return classForNameWithExceptionPEA(name, getContextClassLoader()); }
/** * Get privileged exception action to obtain Class from given class name. * If run using security manager, the returned privileged exception action * must be invoked within a doPrivileged block. * <p> * The actual context class loader will be utilized if accessible and non-null. * Otherwise the defining class loader of the calling class will be utilized. * * @param <T> class type. * @param name class name. * @return privileged exception action to obtain the Class. * The action could throw {@link ClassNotFoundException} or return {@code null} if the class cannot be found. * @throws ClassNotFoundException when provided string contains classname of unknown class. * @see AccessController#doPrivileged(java.security.PrivilegedExceptionAction) */ public static <T> PrivilegedExceptionAction<Class<T>> classForNameWithExceptionPEA(final String name) throws ClassNotFoundException { return classForNameWithExceptionPEA(name, getContextClassLoader()); }