日期:2014-05-17 浏览次数:20810 次
package cn.itcast.utils;
public class DaoFactory {
private DaoFactory(){}
private static final DaoFactory instance=new DaoFactory();//单例化
public static DaoFactory getInstance(){
return instance;
}
public <T> T createDao(String className,Class<T> clazz){
try {
return (T) Class.forName(className).newInstance();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}