Here you can find the source of getGenericTypes(final Class> iClass)
Parameter | Description |
---|---|
iClass | Class to examine |
public static Type[] getGenericTypes(final Class<?> iClass)
//package com.java2s; //License from project: Apache License import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; public class Main { /**//from w ww . j a va2s. co m * Returns the declared generic types of a class. * * @param iClass * Class to examine * @return The array of Type if any, otherwise null */ public static Type[] getGenericTypes(final Class<?> iClass) { final Type genericType = iClass.getGenericInterfaces()[0]; if (genericType != null && genericType instanceof ParameterizedType) { final ParameterizedType pt = (ParameterizedType) genericType; if (pt.getActualTypeArguments() != null && pt.getActualTypeArguments().length > 1) return pt.getActualTypeArguments(); } return null; } }