/**
* <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;
}
}
常用到的类实例化
最新推荐文章于 2018-05-15 19:26:30 发布