code: private static boolean isAssignable(final Type type, final Class<?> toClass) {
          if (type == null) {
              // consistency with ClassUtils.isAssignable() behavior
              return toClass == null || !toClass.isPrimitive();
          }
  
          // only a null type can be assigned to null type which
          // would have cause the previous to return true
          if (toClass == null) {
              return false;
          }
  
          // all types are assignable to themselves
          if (toClass.equals(type)) {
              return true;
          }
  
          if (type instanceof Class<?>) {
              toClass.isAssignableFrom((Class<?>) type);
              // just comparing two classes
              return toClass.isAssignableFrom((Class<?>) type);
          }
  
          if (type instanceof ParameterizedType) {
              // only have to compare the raw type to the class
              return isAssignable(getRawType((ParameterizedType) type), toClass);
          }
  
          if (type instanceof TypeVariable<?>) {
              // if any of the bounds are assignable to the class, then the
              // type is assignable to the class.
              for (final Type bound : ((TypeVariable<?>) type).getBounds()) {
                  if (isAssignable(bound, toClass)) {
                      return true;
                  }
              }
  
              return false;
          }
  
          // the only classes to which a generic array type can be assigned
          // are class Object and array classes
          if (type instanceof GenericArrayType) {
              return toClass.equals(Object.class)
                      || toClass.isArray()
                      && isAssignable(((GenericArrayType) type).getGenericComponentType(), toClass
                      .getComponentType());
          }
  
          // wildcard types are not assignable to a class (though one would think
          // "? super Object" would be assignable to Object)
          if (type instanceof WildcardType) {
              return false;
          }
  
          throw new IllegalStateException("found an unhandled type: " + type);
      }
docs: <p>Checks if the subject type may be implicitly cast to the target class
  following the Java generics rules.</p>
  
  @param type    the subject type to be assigned to the target type
  @param toClass the target class
  @return {@code true} if {@code type} is assignable to {@code toClass}.