code: public static Class<?> getTypeParameter(Class<?> genericType, Class<?> type) {
          Type[] genericInterfaces = type.getGenericInterfaces();
          for (Type genericInterface : genericInterfaces) {
              if (genericInterface instanceof ParameterizedType) {
                  ParameterizedType parameterizedType = (ParameterizedType) genericInterface;
                  if (genericType.equals(parameterizedType.getRawType())) {
                      Type typeParameter = ((ParameterizedType) genericInterface).getActualTypeArguments()[0];
                      if (typeParameter instanceof Class<?>) {
                          return (Class<?>) typeParameter;
                      }
                  }
              }
          }
          return null;
      }
docs: Determines the type of a class implementing a generic interface with one type
  parameter.
  
  @param genericType
  The generic interface type.
  @param type
  The type to determine the parameter from.
  @return The type parameter.