001 package org.kuali.common.util;
002
003 public class ReflectionUtils extends org.springframework.util.ReflectionUtils {
004
005 public static Class<?> getClass(String className) {
006 try {
007 return Class.forName(className);
008 } catch (ClassNotFoundException e) {
009 throw new IllegalArgumentException(e);
010 }
011 }
012
013 public static <T> T newInstance(String className) {
014 @SuppressWarnings("unchecked")
015 Class<T> clazz = (Class<T>) getClass(className);
016 return (T) newInstance(clazz);
017 }
018
019 public static <T> T newInstance(Class<T> instanceClass) {
020 try {
021 return (T) instanceClass.newInstance();
022 } catch (IllegalAccessException e) {
023 throw new IllegalArgumentException("Unexpected error", e);
024 } catch (InstantiationException e) {
025 throw new IllegalArgumentException("Unexpected error", e);
026 }
027 }
028
029 }