@BenchmarkOptions(benchmarkRounds = 100, warmupRounds = 1) @Test public void crateInstanceWithParameters() { JClass obj = Activators.createInstance(JClass.class, 100, "Dynamic", 200); Assert.assertNotNull(obj); Assert.assertEquals(100, obj.getId()); Assert.assertEquals("Dynamic", obj.getName()); }
public static Object createInstance(String className) { log.trace("create instance... className=[{}]", className); try { return createInstance(Class.forName(className)); } catch (Exception e) { throw new RuntimeException(e); } }
Activators { public static Object createInstance(String className) { log.trace("create instance... className=[{}]", className); try { return createInstance(Class.forName(className)); } catch (Exception e) { throw new RuntimeException(e); } } }
Activators { public static Object createInstance(String className) { log.trace("create instance... className=[{}]", className); try { return createInstance(Class.forName(className)); } catch (Exception e) { throw new RuntimeException(e); } } private  Activators(); }
Activators { public static Object createInstance(String className) { log.trace("create instance... className=[{}]", className); try { return createInstance(Class.forName(className)); } catch (Exception e) { throw new RuntimeException(e); } } private  Activators(); static Object createInstance(String className); static T createInstance(Class<T> clazz); @SuppressWarnings("unchecked") static T createInstance(Class<T> clazz, Object... initArgs); static Constructor<T> getConstructor(Class<T> clazz, Class<?>... parameterTypes); }
Activators { public static Object createInstance(String className) { log.trace("create instance... className=[{}]", className); try { return createInstance(Class.forName(className)); } catch (Exception e) { throw new RuntimeException(e); } } private  Activators(); static Object createInstance(String className); static T createInstance(Class<T> clazz); @SuppressWarnings("unchecked") static T createInstance(Class<T> clazz, Object... initArgs); static Constructor<T> getConstructor(Class<T> clazz, Class<?>... parameterTypes);  }