public static Object newInstance(String type) throws FacesException { if (type == null) { return null; } return newInstance(simpleClassForName(type)); }
public static Object newInstance(String type, Class[] expectedTypes) { if (type == null) { return null; } Class clazzForName = simpleClassForName(type); if(expectedTypes != null) { for (int i = 0, size = expectedTypes.length; i < size; i++) { if (!expectedTypes[i].isAssignableFrom(clazzForName)) { throw new FacesException("'" + type + "' does not implement expected type '" + expectedTypes[i] + "'"); } } } return newInstance(clazzForName); }
Class<? extends T> implClass = ClassUtils.simpleClassForName(implClassName);