public <T extends Module>void attachModule(Class<T> module){
  try {
    Constructor<T> constructor=module.getConstructor(DialogueSystem.class);
    attachModule(constructor.newInstance(this));
    displayComment("Module " + module.getSimpleName() + " successfully attached");
  }
 catch (  InstantiationException|IllegalAccessException|IllegalArgumentException|InvocationTargetException|NoSuchMethodException|SecurityException e) {
    log.warning("cannot attach " + module.getSimpleName() + ": "+ e.getCause());
    displayComment("cannot attach " + module.getSimpleName() + ": "+ e.getCause());
  }
}

public < T extends Module > void attachModule ( Class < T > module ) { try { Constructor < T > constructor = module . getConstructor ( DialogueSystem . class ) ; attachModule ( constructor . newInstance ( this ) ) ; displayComment ( "Module " + module . getSimpleName ( ) + " successfully attached" ) ; } catch ( InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e ) { log . warning ( "cannot attach " + module . getSimpleName ( ) + ": " + e . getCause ( ) ) ; displayComment ( "cannot attach " + module . getSimpleName ( ) + ": " + e . getCause ( ) ) ; } }
attaches the module to the dialogue system .
