protected DataTableService(){
this.entityClass = null;
Class clazz = getClass();
Type type = clazz.getGenericSuperclass();
if (type instanceof ParameterizedType) {
Type[] p = ((ParameterizedType) type).getActualTypeArguments();
this.entityClass = (Class<T>) p[0];
}
if(this.entityClass==null){
throw new IllegalArgumentException("缺少泛型参数,实体类");
}
}
转载于:https://my.oschina.net/xl76832215/blog/502469