public static <U extends Object,S extends Service<U>>boolean launchServiceByClass(Class<? extends S> c,U user,Frame owner){
  boolean success=false;
  S ret=null;
  for (  Service<?> s : SERVICE_TO_USER_MAP.keySet()) {
    if (c.isInstance(s)) {
      s.pullToFront();
      return true;
    }
  }
  try {
    ret=c.newInstance();
    SERVICE_TO_USER_MAP.put(ret,user);
    ret.setupGUI(owner);
    ret.launch();
    success=true;
  }
 catch (  InstantiationException|IllegalAccessException e) {
    LOG.severe("Problem creating a new service by class. " + e.getMessage());
  }
  return success;
}

public static < U extends Object , S extends Service < U > > boolean launchServiceByClass ( Class < ? extends S > c , U user , Frame owner ) { boolean success = false ; S ret = null ; for ( Service < ? > s : SERVICE_TO_USER_MAP . keySet ( ) ) { if ( c . isInstance ( s ) ) { s . pullToFront ( ) ; return true ; } } try { ret = c . newInstance ( ) ; SERVICE_TO_USER_MAP . put ( ret , user ) ; ret . setupGUI ( owner ) ; ret . launch ( ) ; success = true ; } catch ( InstantiationException | IllegalAccessException e ) { LOG . severe ( "Problem creating a new service by class. " + e . getMessage ( ) ) ; } return success ; }
gets a new service for the given class and user .
