common_helper/src/main/java/com/xiongyingqi/util/EntityHelper.java
public static Type[] getGenericTypes(Class<?> clazz) {
        Type mySuperClass = clazz.getGenericSuperclass();
        System.out.println(mySuperClass);
        System.out.println(mySuperClass.getClass());
        Type[] types = ((ParameterizedType) mySuperClass).getActualTypeArguments();
        for (int i = 0; i < types.length; i++) {
            Type type = types[i];
            System.out.println(type);
        }
        return types;
    }
public static Type[] getGenericTypes(Class<?> clazz) {
        Type mySuperClass = clazz.getGenericSuperclass();
        System.out.println(mySuperClass);
        System.out.println(mySuperClass.getClass());
        Type[] types = ((ParameterizedType) mySuperClass).getActualTypeArguments();
        for (int i = 0; i < types.length; i++) {
            Type type = types[i];
            System.out.println(type);
        }
        return types;
    }
public static Type [ ] getGenericTypes ( Class < ? > clazz ) { Type mySuperClass = clazz . getGenericSuperclass ( ) ; System . out . println ( mySuperClass ) ; System . out . println ( mySuperClass . getClass ( ) ) ; Type [ ] types = ( ( ParameterizedType ) mySuperClass ) . getActualTypeArguments ( ) ; for ( int i = 0 ; i < types . length ; i ++ ) { Type type = types [ i ] ; System . out . println ( type ) ; } return types ; }
获取该class所表示的父类的泛型数组 <br>
例如如下定义中：

<pre>
class GenericSuperClass&lt;T&gt; {
}

class GenericSubClass&lt;String&gt; {
public void doGetSuperGenericTypes() {
EntityHelper.getGenericTypes(getClass());
}
}
</pre>
只用GenericSubClass中的方法调用才有效果
2014年2月25日 下午5:45:49

@param clazz
@return
获取该class所表示的父类的泛型数组 <br > 例如如下定义中：