//定义泛型的class private Class type; //在构造方法中初始化泛型class public **() { this.type = this.getTypeClass(); } /** * 获得泛型的class的方法 * @return */ @SuppressWarnings("rawtypes") private Class getTypeClass(){ Class clazz = (Class)((ParameterizedType) this.getClass().getGenericSuperclass()) .getActualTypeArguments()[0]; return clazz; }