private Object loadObject(String className,Class<?>[] argsClass,Object[] args){
  Object o=null;
  Class<?> objClass=getClass(className);
  Constructor<?> constructor;
  try {
    if (argsClass != null) {
      constructor=objClass.getConstructor((Class[])argsClass);
      o=constructor.newInstance(args);
    }
 else {
      o=objClass.newInstance();
    }
  }
 catch (  SecurityException e) {
    e.printStackTrace();
    throw new SettingsError("Fatal exception " + e,e);
  }
catch (  IllegalArgumentException e) {
    e.printStackTrace();
    throw new SettingsError("Fatal exception " + e,e);
  }
catch (  NoSuchMethodException e) {
    throw new SettingsError("Class '" + className + "' doesn't have a suitable constructor",e);
  }
catch (  InstantiationException e) {
    throw new SettingsError("Can't create an instance of '" + className + "'",e);
  }
catch (  IllegalAccessException e) {
    e.printStackTrace();
    throw new SettingsError("Fatal exception " + e,e);
  }
catch (  InvocationTargetException e) {
    if (e.getCause() instanceof SettingsError) {
      throw (SettingsError)e.getCause();
    }
 else {
      e.printStackTrace();
      throw new SimError("Couldn't create settings-accepting object" + " for '" + className + "'\n"+ "cause: "+ e.getCause(),e);
    }
  }
  return o;
}

private Object loadObject ( String className , Class < ? > [ ] argsClass , Object [ ] args ) { Object o = null ; Class < ? > objClass = getClass ( className ) ; Constructor < ? > constructor ; try { if ( argsClass != null ) { constructor = objClass . getConstructor ( ( Class [ ] ) argsClass ) ; o = constructor . newInstance ( args ) ; } else { o = objClass . newInstance ( ) ; } } catch ( SecurityException e ) { e . printStackTrace ( ) ; throw new SettingsError ( "Fatal exception " + e , e ) ; } catch ( IllegalArgumentException e ) { e . printStackTrace ( ) ; throw new SettingsError ( "Fatal exception " + e , e ) ; } catch ( NoSuchMethodException e ) { throw new SettingsError ( "Class '" + className + "' doesn't have a suitable constructor" , e ) ; } catch ( InstantiationException e ) { throw new SettingsError ( "Can't create an instance of '" + className + "'" , e ) ; } catch ( IllegalAccessException e ) { e . printStackTrace ( ) ; throw new SettingsError ( "Fatal exception " + e , e ) ; } catch ( InvocationTargetException e ) { if ( e . getCause ( ) instanceof SettingsError ) { throw ( SettingsError ) e . getCause ( ) ; } else { e . printStackTrace ( ) ; throw new SimError ( "Couldn't create settings-accepting object" + " for '" + className + "'\n" + "cause: " + e . getCause ( ) , e ) ; } } return o ; }
dynamically loads and creates an object .
