private static boolean isKindOf(Type t, Type typeToMatch)
  {
    if(t == null || typeToMatch == null) {
      return false;
    }
    if(t.equals(typeToMatch)) {
      return true;
    }

    Class<?> clazz = typeToClass(t);
    Class<?> classToMatch = typeToClass(typeToMatch);

    if(clazz.isPrimitive()) {
      return BOXING_MAP.get(clazz) == classToMatch;
    }
    if(classToMatch.isPrimitive()) {
      return BOXING_MAP.get(classToMatch) == clazz;
    }

    return classToMatch.isAssignableFrom(clazz);
  }
private static boolean isKindOf ( Type t , Type typeToMatch ) { if ( t == null || typeToMatch == null ) { return false ; } if ( t . equals ( typeToMatch ) ) { return true ; } Class < ? > clazz = typeToClass ( t ) ; Class < ? > classToMatch = typeToClass ( typeToMatch ) ; if ( clazz . isPrimitive ( ) ) { return BOXING_MAP . get ( clazz ) == classToMatch ; } if ( classToMatch . isPrimitive ( ) ) { return BOXING_MAP . get ( classToMatch ) == clazz ; } return classToMatch . isAssignableFrom ( clazz ) ; }
Determine if a given type is a kind of a requested type to match. Returns true if <code>type</code> is a subclass
or implements <code>typeToMatch</code> - not necessarily direct. Boxing classes for primitive values are
compatible. This depart from {@link Class#isAssignableFrom(Class)} that consider primitive and related boxing class
as different.
<p>
If either type or type to match are parameterized types uses the raw class. If either type or type to match are
null returns false.

@param t type to test,
@param typeToMatch desired type to match.
@return true if <code>type</code> is subclass of or implements <code>typeToMatch</code>.