@Test public void testInstantiateParamConstructor() throws Exception { String className = "java.lang.StringBuffer"; String[] types = new String[]{"java.lang.String"}; Object[] values = new Object[]{"전자정부 공통서비스"}; StringBuffer sb = (StringBuffer)EgovObjectUtil.instantiate(className, types, values); sb.append(" 및 개발프레임워크 구축 사업"); assertEquals("전자정부 공통서비스 및 개발프레임워크 구축 사업", sb.toString()); LOGGER.debug(sb.toString()); }
public static Object instantiate(String className) throws ClassNotFoundException, InstantiationException, IllegalAccessException, Exception { Class<?> clazz; try { clazz = loadClass(className); return clazz.newInstance(); } catch (ClassNotFoundException e) { LOGGER.error("{} : Class is can not instantialized.", className); throw new ClassNotFoundException(); } catch (InstantiationException e) { LOGGER.error("{} : Class is can not instantialized.", className); throw new InstantiationException(); } catch (IllegalAccessException e) { LOGGER.error("{} : Class is not accessed.", className); throw new IllegalAccessException(); } catch (Exception e) { LOGGER.error("{} : Class is not accessed.", className); throw new Exception(e); } }
EgovObjectUtil { public static Object instantiate(String className) throws ClassNotFoundException, InstantiationException, IllegalAccessException, Exception { Class<?> clazz; try { clazz = loadClass(className); return clazz.newInstance(); } catch (ClassNotFoundException e) { LOGGER.error("{} : Class is can not instantialized.", className); throw new ClassNotFoundException(); } catch (InstantiationException e) { LOGGER.error("{} : Class is can not instantialized.", className); throw new InstantiationException(); } catch (IllegalAccessException e) { LOGGER.error("{} : Class is not accessed.", className); throw new IllegalAccessException(); } catch (Exception e) { LOGGER.error("{} : Class is not accessed.", className); throw new Exception(e); } } }
EgovObjectUtil { public static Object instantiate(String className) throws ClassNotFoundException, InstantiationException, IllegalAccessException, Exception { Class<?> clazz; try { clazz = loadClass(className); return clazz.newInstance(); } catch (ClassNotFoundException e) { LOGGER.error("{} : Class is can not instantialized.", className); throw new ClassNotFoundException(); } catch (InstantiationException e) { LOGGER.error("{} : Class is can not instantialized.", className); throw new InstantiationException(); } catch (IllegalAccessException e) { LOGGER.error("{} : Class is not accessed.", className); throw new IllegalAccessException(); } catch (Exception e) { LOGGER.error("{} : Class is not accessed.", className); throw new Exception(e); } } private  EgovObjectUtil(); }
EgovObjectUtil { public static Object instantiate(String className) throws ClassNotFoundException, InstantiationException, IllegalAccessException, Exception { Class<?> clazz; try { clazz = loadClass(className); return clazz.newInstance(); } catch (ClassNotFoundException e) { LOGGER.error("{} : Class is can not instantialized.", className); throw new ClassNotFoundException(); } catch (InstantiationException e) { LOGGER.error("{} : Class is can not instantialized.", className); throw new InstantiationException(); } catch (IllegalAccessException e) { LOGGER.error("{} : Class is not accessed.", className); throw new IllegalAccessException(); } catch (Exception e) { LOGGER.error("{} : Class is not accessed.", className); throw new Exception(e); } } private  EgovObjectUtil(); static Class<?> loadClass(String className); static Object instantiate(String className); static Object instantiate(String className, String[] types, Object[] values); static boolean isNull(Object object); }
EgovObjectUtil { public static Object instantiate(String className) throws ClassNotFoundException, InstantiationException, IllegalAccessException, Exception { Class<?> clazz; try { clazz = loadClass(className); return clazz.newInstance(); } catch (ClassNotFoundException e) { LOGGER.error("{} : Class is can not instantialized.", className); throw new ClassNotFoundException(); } catch (InstantiationException e) { LOGGER.error("{} : Class is can not instantialized.", className); throw new InstantiationException(); } catch (IllegalAccessException e) { LOGGER.error("{} : Class is not accessed.", className); throw new IllegalAccessException(); } catch (Exception e) { LOGGER.error("{} : Class is not accessed.", className); throw new Exception(e); } } private  EgovObjectUtil(); static Class<?> loadClass(String className); static Object instantiate(String className); static Object instantiate(String className, String[] types, Object[] values); static boolean isNull(Object object);  }