code: private static Type resolveType(Class<?> rootClass, Type[] parameters, Class<?> targetClass)
      {
          // Look at super interfaces
          for (Type interfaceType : rootClass.getGenericInterfaces()) {
              Type type = resolveType(interfaceType, rootClass, parameters, targetClass);
              if (type != null) {
                  return type;
              }
          }
  
          Type superType = rootClass.getGenericSuperclass();
          if (superType != null) {
              return resolveType(superType, rootClass, parameters, targetClass);
          }
  
          return null;
      }
docs: Find the real generic parameters of the passed target class from the extending/implementing root class and create
  a Type from it.
  
  @param rootClass the root class from which to start searching
  @param parameters the parameters of the root class
  @param targetClass the class from which to resolve the generic parameters
  @return a {@link ParameterizedType} version of the passed target class with resolved parameters