@Test public void testCreateObjectConstructorObjectArray() throws NoSuchMethodException, SecurityException { Constructor<Point> pointConstructor = Point.class.getConstructor(new Class[0]); Point p = null; p = (Point) ClassCreation.createObject(pointConstructor, new Object[0]); assertNotNull(p); assertEquals(p, new Point(0,0)); pointConstructor = Point.class.getConstructor(new Class[]{Integer.TYPE, Integer.TYPE}); p = null; p = (Point) ClassCreation.createObject(pointConstructor, new Object[]{4,5}); assertNotNull(p); assertEquals(p, new Point(4,5)); }
@SuppressWarnings("rawtypes") public static Object createObject(String label) throws NoSuchMethodException { Class className = Parameters.parameters.classParameter(label); if (className == null) { System.out.println("Error: Class Name null for label: " + label); return null; } return createObject(className); }
ClassCreation { @SuppressWarnings("rawtypes") public static Object createObject(String label) throws NoSuchMethodException { Class className = Parameters.parameters.classParameter(label); if (className == null) { System.out.println("Error: Class Name null for label: " + label); return null; } return createObject(className); } }
ClassCreation { @SuppressWarnings("rawtypes") public static Object createObject(String label) throws NoSuchMethodException { Class className = Parameters.parameters.classParameter(label); if (className == null) { System.out.println("Error: Class Name null for label: " + label); return null; } return createObject(className); }  }
ClassCreation { @SuppressWarnings("rawtypes") public static Object createObject(String label) throws NoSuchMethodException { Class className = Parameters.parameters.classParameter(label); if (className == null) { System.out.println("Error: Class Name null for label: " + label); return null; } return createObject(className); }  @SuppressWarnings("rawtypes") // Any type is possible, so it must be raw static Object createObject(String label); @SuppressWarnings({ "rawtypes", "unchecked" }) // Any type is possible, so it must be raw static Object createObject(Class className); @SuppressWarnings("rawtypes") // Any type is possible, so it must be raw static Object createObject(Constructor constructor); @SuppressWarnings("rawtypes") // Any type is possible, so it must be raw static Object createObject(Constructor constructor, Object[] arguments); }
ClassCreation { @SuppressWarnings("rawtypes") public static Object createObject(String label) throws NoSuchMethodException { Class className = Parameters.parameters.classParameter(label); if (className == null) { System.out.println("Error: Class Name null for label: " + label); return null; } return createObject(className); }  @SuppressWarnings("rawtypes") // Any type is possible, so it must be raw static Object createObject(String label); @SuppressWarnings({ "rawtypes", "unchecked" }) // Any type is possible, so it must be raw static Object createObject(Class className); @SuppressWarnings("rawtypes") // Any type is possible, so it must be raw static Object createObject(Constructor constructor); @SuppressWarnings("rawtypes") // Any type is possible, so it must be raw static Object createObject(Constructor constructor, Object[] arguments);  }