/** * Uses reflection to invoke the init(Properties props) method on the loaderClass field * @param properties * @return * @throws Exception */ public Object init(Properties properties) throws Exception { Class loaderClass = load(); try { // get the init method Method init = loaderClass.getMethod("init", Properties.class); // create the instance Object instance = loaderClass.newInstance(); // invoke init method Object value = init.invoke(instance, properties); return value; } catch (NoSuchMethodException e) { throw (IllegalStateException) new IllegalStateException("Signatures for Loader are no longer correct.").initCause(e); } catch (InvocationTargetException e) { Throwable cause = e.getCause(); if (cause instanceof Error) { throw (Error) cause; } else { throw (Exception) cause; } } }
/** * Uses reflection to invoke the init(Properties props) method on the loaderClass field * * @param properties * @return * @throws Exception */ public Object init(final Properties properties) throws Exception { final Class loaderClass = load(); try { // get the init method final Method init = loaderClass.getMethod("init", Properties.class); // create the instance final Object instance = loaderClass.newInstance(); // invoke init method final Object value = init.invoke(instance, properties); return value; } catch (final NoSuchMethodException e) { throw (IllegalStateException) new IllegalStateException("Signatures for Loader are no longer correct.").initCause(e); } catch (final InvocationTargetException e) { final Throwable cause = e.getCause(); if (cause instanceof Error) { throw (Error) cause; } else { throw (Exception) cause; } } }
/** * Uses reflection to invoke the init(Properties props) method on the loaderClass field * * @param properties * @return * @throws Exception */ public Object init(final Properties properties) throws Exception { final Class loaderClass = load(); try { // get the init method final Method init = loaderClass.getMethod("init", Properties.class); // create the instance final Object instance = loaderClass.newInstance(); // invoke init method final Object value = init.invoke(instance, properties); return value; } catch (final NoSuchMethodException e) { throw (IllegalStateException) new IllegalStateException("Signatures for Loader are no longer correct.").initCause(e); } catch (final InvocationTargetException e) { final Throwable cause = e.getCause(); if (cause instanceof Error) { throw (Error) cause; } else { throw (Exception) cause; } } }