code: public static boolean isClassOrInterface(Type type) {
      if (!(type instanceof Class)) {
        return false;
      }
  
      Class clazz = (Class) type;
      return !clazz.isPrimitive() && !clazz.isAnnotation() && !clazz.isArray() && !clazz.isEnum()
          && !clazz.isAnonymousClass();
    }
docs: Returns {@code true} if the passed type is either a class or an interface
  (but not a primitive, enum or similar).
  
  @param type class to be checked
  @return {@code true} if the passed type is a class or interface