/** Get an instance of the named factory instance. If the Liistener implements * CopyJAMonListener then copy will be called. If not then the default constructor will * be called. * * @param listenerName * @return JAMonListener */ public static JAMonListener get(String listenerName) { try { JAMonListener factoryInstance =(JAMonListener)map.get(listenerName); if (factoryInstance instanceof CopyJAMonListener) { return ((CopyJAMonListener)factoryInstance).copy(); } else { JAMonListener newInst = factoryInstance.getClass().newInstance(); newInst.setName(factoryInstance.getName()); return newInst; } } catch (Exception e) { throw new RuntimeException("Error getting listener from factory: "+listenerName+", "+e); } }
/** Get an instance of the named factory instance. If the Liistener implements * CopyJAMonListener then copy will be called. If not then the default constructor will * be called. * * @param listenerName * @return */ public static JAMonListener get(String listenerName) { try { JAMonListener factoryInstance =(JAMonListener)map.get(listenerName); if (factoryInstance instanceof CopyJAMonListener) { return ((CopyJAMonListener)factoryInstance).copy(); } else { JAMonListener newInst = (JAMonListener)factoryInstance.getClass().newInstance(); newInst.setName(factoryInstance.getName()); return newInst; } } catch (Exception e) { throw new RuntimeException("Error getting listener from factory: "+listenerName+", "+e); } }