code: public static boolean isInstanceOf(TypeRef type, TypeDef targetType, Function<TypeRef, Boolean> function) {
          if (type instanceof ClassRef) {
              ClassRef classRef = (ClassRef) type;
              TypeDef definition = classRef.getDefinition();
              if (definition.getFullyQualifiedName().equals(targetType.getFullyQualifiedName())) {
                  return true;
              }
  
              for (TypeRef i : definition.getImplementsList()) {
                  if (function.apply(i)) {
                      return true;
                  }
              }
  
              for (TypeRef e : definition.getExtendsList()) {
                  if (function.apply(e)) {
                      return true;
                  }
              }
          }
          return false;
      }
docs: Checks if a {@link TypeDef} is an instance of an other {@link TypeDef}.
  @param type          The type to compare.
  @param targetType    The target type.
  @param function
  @return  true if match, false otherwise.