@BenchmarkOptions(benchmarkRounds = 100, warmupRounds = 1) @Test public void crateInstanceWithParameterTypes() throws Exception { JClass obj = (JClass) Activators .getConstructor(JClass.class, Integer.TYPE, String.class, Integer.class) .newInstance(100, "Dynamic", 200); Assert.assertNotNull(obj); Assert.assertEquals(100, obj.getId()); Assert.assertEquals("Dynamic", obj.getName()); }
public static <T> Constructor<T> getConstructor(Class<T> clazz, Class<?>... parameterTypes) { log.trace("[{}] 수형의 생성자를 구합니다. parameterTypes=[{}]", clazz.getName(), StringTool.listToString(parameterTypes)); try { return clazz.getDeclaredConstructor(parameterTypes); } catch (Exception e) { throw new RuntimeException(e); } }
Activators { public static <T> Constructor<T> getConstructor(Class<T> clazz, Class<?>... parameterTypes) { log.trace("[{}] 수형의 생성자를 구합니다. parameterTypes=[{}]", clazz.getName(), StringTool.listToString(parameterTypes)); try { return clazz.getDeclaredConstructor(parameterTypes); } catch (Exception e) { throw new RuntimeException(e); } } }
Activators { public static <T> Constructor<T> getConstructor(Class<T> clazz, Class<?>... parameterTypes) { log.trace("[{}] 수형의 생성자를 구합니다. parameterTypes=[{}]", clazz.getName(), StringTool.listToString(parameterTypes)); try { return clazz.getDeclaredConstructor(parameterTypes); } catch (Exception e) { throw new RuntimeException(e); } } private  Activators(); }
Activators { public static <T> Constructor<T> getConstructor(Class<T> clazz, Class<?>... parameterTypes) { log.trace("[{}] 수형의 생성자를 구합니다. parameterTypes=[{}]", clazz.getName(), StringTool.listToString(parameterTypes)); try { return clazz.getDeclaredConstructor(parameterTypes); } 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 <T> Constructor<T> getConstructor(Class<T> clazz, Class<?>... parameterTypes) { log.trace("[{}] 수형의 생성자를 구합니다. parameterTypes=[{}]", clazz.getName(), StringTool.listToString(parameterTypes)); try { return clazz.getDeclaredConstructor(parameterTypes); } 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);  }