首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

惯用到的类实例化

2012-09-18 
常用到的类实例化/** * p类的描述:/p * @author gao.tang * @version 1.0 * @date 2011-3-7 下午02:12

常用到的类实例化

/** * <p>类的描述:</p> * @author gao.tang * @version 1.0 * @date 2011-3-7 下午02:12:31 */public class LoadExtClassUtil {public static boolean isNull(String param){return (param == null || "".equals(param));}public static Object getInstance(String extClass,String defaultExtClass){Object object = null;try {object = Class.forName(extClass).newInstance();} catch (InstantiationException e) {e.printStackTrace();try {object =   Class.forName(defaultExtClass).newInstance();} catch (InstantiationException e1) {e1.printStackTrace();} catch (IllegalAccessException e1) {e1.printStackTrace();} catch (ClassNotFoundException e1) {e1.printStackTrace();}} catch (IllegalAccessException e) {e.printStackTrace();try {object = Class.forName(defaultExtClass).newInstance();} catch (InstantiationException e1) {e1.printStackTrace();} catch (IllegalAccessException e1) {e1.printStackTrace();} catch (ClassNotFoundException e1) {e1.printStackTrace();}} catch (ClassNotFoundException e) {e.printStackTrace();try {object = Class.forName(defaultExtClass).newInstance();} catch (InstantiationException e1) {e1.printStackTrace();} catch (IllegalAccessException e1) {e1.printStackTrace();} catch (ClassNotFoundException e1) {e1.printStackTrace();}}return object;}}

热点排行