标签:type imp gen port extends arguments ase dao pre
public class BaseDaoImpl<T> extends HibernateDaoSupport implements BaseDao<T> { private Class clazz;//用于接收运行期泛型类型 public BaseDaoImpl(){ //获得当前类型的带有泛型类型的父类 ParameterizedType pd = (ParameterizedType) this.getClass().getGenericSuperclass(); clazz = (Class) pd.getActualTypeArguments()[0]; } } //clazz.getClass()就可以获取到运行时的类型
标签:type imp gen port extends arguments ase dao pre
原文地址:http://www.cnblogs.com/ms-grf/p/7493241.html