code: private static Map<TypeVariable<?>, Type> getTypeArguments(final Type type, final Class<?> toClass,
                                                                 final Map<TypeVariable<?>, Type> subtypeVarAssigns) {
          if (type instanceof Class<?>) {
              return getTypeArguments((Class<?>) type, toClass, subtypeVarAssigns);
          }
  
          if (type instanceof ParameterizedType) {
              return getTypeArguments((ParameterizedType) type, toClass, subtypeVarAssigns);
          }
  
          if (type instanceof GenericArrayType) {
              return getTypeArguments(((GenericArrayType) type).getGenericComponentType(), toClass
                      .isArray() ? toClass.getComponentType() : toClass, subtypeVarAssigns);
          }
  
          // since wildcard types are not assignable to classes, should this just
          // return null?
          if (type instanceof WildcardType) {
              for (final Type bound : getImplicitUpperBounds((WildcardType) type)) {
                  // find the first bound that is assignable to the target class
                  if (isAssignable(bound, toClass)) {
                      return getTypeArguments(bound, toClass, subtypeVarAssigns);
                  }
              }
  
              return null;
          }
  
          if (type instanceof TypeVariable<?>) {
              for (final Type bound : getImplicitBounds((TypeVariable<?>) type)) {
                  // find the first bound that is assignable to the target class
                  if (isAssignable(bound, toClass)) {
                      return getTypeArguments(bound, toClass, subtypeVarAssigns);
                  }
              }
  
              return null;
          }
          throw new IllegalStateException("found an unhandled type: " + type);
      }
docs: <p>Return a map of the type arguments of {@code type} in the context of {@code toClass}.</p>
  
  @param type              the type in question
  @param toClass           the class
  @param subtypeVarAssigns a map with type variables
  @return the {@code Map} with type arguments