code: public static Map<TypeVariable<?>, Type> getTypeVariableMap(final Class<?> clazz) {
          final Map<TypeVariable<?>, Type> map = new LinkedHashMap<TypeVariable<?>, Type>(4);
  
          final TypeVariable<?>[] typeParameters = clazz.getTypeParameters();
          for (TypeVariable<?> typeParameter : typeParameters) {
              map.put(typeParameter, getActualClass(typeParameter.getBounds()[0], map));
          }
  
          final Class<?> superClass = clazz.getSuperclass();
          final Type superClassType = clazz.getGenericSuperclass();
          if (superClass != null) {
              gatherTypeVariables(superClass, superClassType, map);
          }
  
          final Class<?>[] interfaces = clazz.getInterfaces();
          final Type[] interfaceTypes = clazz.getGenericInterfaces();
          for (int i = 0; i < interfaces.length; ++i) {
              gatherTypeVariables(interfaces[i], interfaceTypes[i], map);
          }
  
          return map;
      }
docs: -------------