Device device; try { Class c = Class.forName(className); Class[] args = { Class.forName("java.util.prefs.Preferences") }; Constructor con = c.getConstructor(args); device = (Device) con.newInstance(new Object[] { prefs }); } catch (Exception e) { ErrorMsg.reportError("Failed to create class for class", "Failed to create class for class '" + className + "'"); return null; }
Device device = PatchEdit.devConfig.createDevice(className, prefs);
    private Device addDevice(String className, Preferences prefs) {	Device device;	try {	    Class c = Class.forName(className);	    Class[] args = { Class.forName("java.util.prefs.Preferences") };	    Constructor con = c.getConstructor(args);	    device = (Device) con.newInstance(new Object[] { prefs });	} catch (Exception e) {	    ErrorMsg.reportError("Failed to create class for class",				 "Failed to create class for class '"				 + className + "'");	    return null;	}	device.setup();    	deviceList.add(device); // always returns true	return device;    }