public class BaseDAOImpl<T, PK extends Serializable> extends HibernateDaoSupport implements IBaseDAO<T, PK> {
private Class<T> entityClass;
@SuppressWarnings("unchecked")
public BaseDAOImpl() {
super();
this.entityClass = (Class<T>) ((ParameterizedType) getClass()
.getGenericSuperclass()).getActualTypeArguments()[0];
}
...
}
代码:获取泛型的Class对象
最新推荐文章于 2022-08-24 09:33:48 发布