1 package org.kuali.common.util;
2
3 public class ReflectionUtils extends org.springframework.util.ReflectionUtils {
4
5 public static Class<?> getClass(String className) {
6 try {
7 return Class.forName(className);
8 } catch (ClassNotFoundException e) {
9 throw new IllegalStateException(e);
10 }
11 }
12
13 @SuppressWarnings("unchecked")
14 public static <T> T newInstance(String className) {
15 Class<?> clazz = getClass(className);
16 return (T) newInstance(clazz);
17 }
18
19 public static <T> T newInstance(Class<T> instanceClass) {
20 try {
21 return (T) instanceClass.newInstance();
22 } catch (IllegalAccessException e) {
23 throw new IllegalStateException("Unexpected error", e);
24 } catch (InstantiationException e) {
25 throw new IllegalStateException("Unexpected error", e);
26 }
27 }
28
29 }