code: public static Class getParameterizedClass(final Class c, final int index) {
          final TypeVariable[] typeVars = c.getTypeParameters();
          if (typeVars.length > 0) {
              final TypeVariable typeVariable = typeVars[index];
              final Type[] bounds = typeVariable.getBounds();
  
              final Type type = bounds[0];
              if (type instanceof Class) {
                  return (Class) type; // broke for EnumSet, cause bounds contain
                  // type instead of class
              } else {
                  return null;
              }
          } else {
              Type superclass = c.getGenericSuperclass();
              if (superclass == null && c.isInterface()) {
                  Type[] interfaces = c.getGenericInterfaces();
                  if (interfaces.length > 0) {
                      superclass = interfaces[index];
                  }
              }
              if (superclass instanceof ParameterizedType) {
                  final Type[] actualTypeArguments = ((ParameterizedType) superclass).getActualTypeArguments();
                  return actualTypeArguments.length > index ? (Class<?>) actualTypeArguments[index] : null;
              } else if (!Object.class.equals(superclass)) {
                  return getParameterizedClass((Class) superclass);
              } else {
                  return null;
              }
          }
      }
docs: Returns the parameterized type in the given position
  
  @param c     the class to examine
  @param index the position of the type to return
  @return the type