/** * Returns the (initialized) class represented by <code>className</code> * using the current thread's context class loader. This implementation * supports the syntaxes "<code>java.util.Map.Entry[]</code>", * "<code>java.util.Map$Entry[]</code>", "<code>[Ljava.util.Map.Entry;</code>", * and "<code>[Ljava.util.Map$Entry;</code>". * * @param className the class name * @return the class represented by <code>className</code> using the current thread's context class loader * @throws ClassNotFoundException if the class is not found */ public static Class getClass(String className) throws ClassNotFoundException { return getClass(className, true); }
/** * Returns the (initialized) class represented by <code>className</code> * using the <code>classLoader</code>. This implementation supports * the syntaxes "<code>java.util.Map.Entry[]</code>", * "<code>java.util.Map$Entry[]</code>", "<code>[Ljava.util.Map.Entry;</code>", * and "<code>[Ljava.util.Map$Entry;</code>". * * @param classLoader the class loader to use to load the class * @param className the class name * @return the class represented by <code>className</code> using the <code>classLoader</code> * @throws ClassNotFoundException if the class is not found */ public static Class getClass(ClassLoader classLoader, String className) throws ClassNotFoundException { return getClass(classLoader, className, true); }
/** * Returns the class represented by <code>className</code> using the * current thread's context class loader. This implementation supports the * syntaxes "<code>java.util.Map.Entry[]</code>", "<code>java.util.Map$Entry[]</code>", * "<code>[Ljava.util.Map.Entry;</code>", and "<code>[Ljava.util.Map$Entry;</code>". * * @param className the class name * @param initialize whether the class must be initialized * @return the class represented by <code>className</code> using the current thread's context class loader * @throws ClassNotFoundException if the class is not found */ public static Class getClass(String className, boolean initialize) throws ClassNotFoundException { ClassLoader contextCL = Thread.currentThread().getContextClassLoader(); ClassLoader loader = contextCL == null ? ClassUtils.class.getClassLoader() : contextCL; return getClass(loader, className, initialize ); }
return getClass(classLoader, className.substring(0, lastDotIndex) + INNER_CLASS_SEPARATOR_CHAR + className.substring(lastDotIndex + 1), initialize);
@SuppressWarnings("unchecked") public static <T> Class<? extends T> getClass(String name, Class<? extends T> defaultValue) { try { Class<?> r = ClassUtils.getClass(name); return (Class<T>) r; } catch (Exception e) { return defaultValue; } } }
/** * Returns the (initialized) class represented by <code>className</code> * using the current thread's context class loader. This implementation * supports names like "<code>java.lang.String[]</code>" as well as * "<code>[Ljava.lang.String;</code>". * * @param className the class name * @return the class represented by <code>className</code> using the current thread's context class loader * @throws ClassNotFoundException if the class is not found */ public static Class getClass(String className) throws ClassNotFoundException { return getClass(className, true); }
/** * Returns the (initialized) class represented by <code>className</code> * using the current thread's context class loader. This implementation * supports names like "<code>java.lang.String[]</code>" as well as * "<code>[Ljava.lang.String;</code>". * * @param className the class name * @return the class represented by <code>className</code> using the current thread's context class loader * @throws ClassNotFoundException if the class is not found */ public static Class getClass(String className) throws ClassNotFoundException { return getClass(className, true); }
@SuppressWarnings("unchecked") public static <T> Class<T> getClass(String name) throws ResourceInitializationException { try { Class<?> r = ClassUtils.getClass(name); return (Class<T>) r; } catch (ClassNotFoundException e) { throw new ResourceInitializationException(e); } }
public static boolean isDisposable( String className ) { boolean disposable = false; try { disposable = Disposable.class.isAssignableFrom( ClassUtils.getClass( className ) ); } catch ( ClassNotFoundException e ) { // ignored } return disposable; }
public static boolean isInitializable( String className ) { boolean initializable = false; try { initializable = Initializable.class.isAssignableFrom( ClassUtils.getClass( className ) ); } catch ( ClassNotFoundException e ) { // ignored } return initializable; }
public static boolean isDisposable( String className ) { boolean disposable = false; try { disposable = Disposable.class.isAssignableFrom( ClassUtils.getClass( className ) ); } catch ( ClassNotFoundException e ) { // ignored } return disposable; }
public static boolean isInitializable( String className ) { boolean initializable = false; try { initializable = Initializable.class.isAssignableFrom( ClassUtils.getClass( className ) ); } catch ( ClassNotFoundException e ) { // ignored } return initializable; }
public static <T> Class<? extends T> getClass(String className, Class<T> type) throws ClassNotFoundException { Class<?> theClass = ClassUtils.getClass(getDefaultClassLoader(), className); return theClass.asSubclass(type); }
public static Class<?> loadClass(ClassLoader classLoader, String className) { try { return ClassUtils.getClass(classLoader, className); } catch (ClassNotFoundException e) { MappingUtils.throwMappingException(e); } return null; }
public static Class<?> loadClass(ClassLoader classLoader, String className) { try { return ClassUtils.getClass(classLoader, className); } catch (ClassNotFoundException e) { MappingUtils.throwMappingException(e); } return null; }
public Class<?> loadClass(String className) { Class<?> result = null; try { // Class caller = Reflection.getCallerClass(3); TODO OSGi fix - Move // to specific implementation result = ClassUtils.getClass(className); } catch (ClassNotFoundException e) { MappingUtils.throwMappingException(e); } return result; }
public static Class getClass(String className) { if (StringUtils.isEmpty(className)) { return null; } try { return ClassUtils.getClass(getDefaultClassLoader(), className); } catch (ClassNotFoundException e) { throw new RiceRuntimeException(e); } }
public static Class<?> getClass(String className) { if (StringUtils.isEmpty(className)) { return null; } try { return ClassUtils.getClass(getDefaultClassLoader(), className); } catch (ClassNotFoundException e) { throw new RiceRuntimeException(e); } }
private Method findMethod(Class<?> argType) { try { Class<?> clazz = ClassUtils.getClass(className); Class<?>[] argTypes = { argType }; return MethodUtils.getMatchingAccessibleMethod(clazz, methodName, argTypes); } catch (ClassNotFoundException ex) { throw new MCRConfigurationException("class configured for external validation not found: " + className); } }
@Override public void completeValidation(Class rootObjectClass, Class otherObjectClass, ValidationTrace tracer) { super.completeValidation(rootObjectClass, otherObjectClass,tracer); if ( StringUtils.isNotBlank(lookupBoClass) ) { try { ClassUtils.getClass(ClassLoaderUtils.getDefaultClassLoader(), getLookupBoClass()); } catch (ClassNotFoundException e) { String currentValues[] = {"property = " + getName(), "class = " + rootObjectClass.getName(), "lookupBoClass = " + getLookupBoClass()}; tracer.createError("lookupBoClass could not be found", currentValues); } } }