public static void printType(Type type, boolean isDefinition)
   {
      if (type instanceof Class)
      {
         Class<?> t = (Class<?>) type;
         System.out.print(t.getName());
      }
      else if (type instanceof TypeVariable)
      {
         TypeVariable<?> t = (TypeVariable<?>) type;
         System.out.print(t.getName());
         if (isDefinition)
            printTypes(t.getBounds(), " extends ", " & ", "", false);
      }
      else if (type instanceof WildcardType)
      {
         WildcardType t = (WildcardType) type;
         System.out.print("?");
         printTypes(t.getUpperBounds(), " extends ", " & ", "", false);
         printTypes(t.getLowerBounds(), " super ", " & ", "", false);
      }
      else if (type instanceof ParameterizedType)
      {
         ParameterizedType t = (ParameterizedType) type;
         Type owner = t.getOwnerType();
         if (owner != null)
         {
            printType(owner, false);
            System.out.print(".");
         }
         printType(t.getRawType(), false);
         printTypes(t.getActualTypeArguments(), "<", ", ", ">", false);
      }
      else if (type instanceof GenericArrayType)
      {
         GenericArrayType t = (GenericArrayType) type;
         System.out.print("");
         printType(t.getGenericComponentType(), isDefinition);
         System.out.print("[]");
      }   }这里
type instanceof WildcardType
type instanceof ParameterizedType
type instanceof TypeVariable
type instanceof GenericArrayType
分别代表什么

解决方案 »

  1.   

    对象 instanceof  类
    这是判断对象属于不属于这个类,是不是这个类的对象
      

  2.   

    instanceof 的作用,就是判断前面的是否是后面的对象。
      

  3.   

    instanceof 的作用,就是判断前面的是否是后面的对象。
    比如Dog extends Animal 那么 Dog instanceof Animal确实如此,为true
      

  4.   

    instanceof  用来判断这个对象属不属于后面的这个类,如果这个对象是类的对象,返回true,否则返回false