免费视频淫片aa毛片_日韩高清在线亚洲专区vr_日韩大片免费观看视频播放_亚洲欧美国产精品完整版

打開APP
userphoto
未登錄

開通VIP,暢享免費(fèi)電子書等14項(xiàng)超值服

開通VIP
DAO做成泛型的知識(shí)
package testDao;

import java.lang.reflect.ParameterizedType;

public class BaseDaoImpl<T,M> {
private Class clazz;

public BaseDaoImpl() {
ParameterizedType pt = (ParameterizedType) this.getClass()
.getGenericSuperclass();
this.clazz = (Class) pt.getActualTypeArguments()[0];
System.out.println("Type為: " + clazz.getSimpleName());
this.clazz=(Class) pt.getActualTypeArguments()[1];
System.out.println("第二個(gè)Type為: " + clazz.getSimpleName());
}
}

參數(shù)化類型

測(cè)試
package testDao;
import bean.BaseRole;
import bean.Person;
public class UserDao extends BaseDaoImpl<Person,BaseRole> {
public static void main(String[] args) {
UserDao dao=new UserDao();
}
}



本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊舉報(bào)。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
萬能的BaseDao設(shè)計(jì)
Biny Framework Wiki
this.clazz = (Class<T>) ((ParameterizedType) getClass()
java通過反射動(dòng)態(tài)讀取類的泛型實(shí)參
spring hibernate的事務(wù)處理(使用hibernate原有的sessionFactory)
如何從spring-data mongodb擴(kuò)展SimpleMongoRepository?
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長(zhǎng)圖 關(guān)注 下載文章
綁定賬號(hào)成功
后續(xù)可登錄賬號(hào)暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服