Code example for Constructor

Methods: setAccessiblenewInstance

0
	} 
 
	public Object getInstance(Class<?> clazz) {
		try { 
			Constructor<?> ctr = clazz.getConstructor(argClasses);
            ctr.setAccessible(true);
			return ctr.newInstance(args);
		} catch (NoSuchMethodException e) {
            logger.severe("Error initializing commands class " + clazz + ": ");
            e.printStackTrace();
			return null; 
		} catch (InvocationTargetException e) {
            logger.severe("Error initializing commands class " + clazz + ": ");
            e.printStackTrace();
			return null; 
		} catch (InstantiationException e) {
            logger.severe("Error initializing commands class " + clazz + ": ");
            e.printStackTrace();
			return null; 
		} catch (IllegalAccessException e) {
            logger.severe("Error initializing commands class " + clazz + ": ");