code: public static void main(String... args) {
  
          // 输出所有常量
          System.out.println("输出所有常量");
          Map<String, ?> constants = getConstantFrom(Character.class, true, true);
          System.out.println(constants);
  
          // 输出方法的返回类型
          System.out.println();
          System.out.println("输出方法的返回类型" + java.lang.ClassLoader.class.getName());
          for (Method method : ClassLoader.class.getMethods()) {
              Class<?>[] classes = resolveTypeParameters(ClassLoader.class,
                  method.getGenericReturnType());
              System.out.print(method.getName() + " = ");
              System.out.println(Arrays.toString(classes));
          }
  
          // 输出超类的类型
          System.out.println();
          System.out.println("输出超类的类型" + java.util.Properties.class.getName());
          Type genericSuperclassType = java.util.Properties.class.getGenericSuperclass();
          System.out.print(genericSuperclassType + " = ");
          System.out.println(Arrays
              .toString(resolveTypeParameters(java.util.Properties.class, genericSuperclassType)));
  
          System.out.println();
          System.out.println("输出派生类的类型" + java.util.Properties.class.getName());
          for (Type genericInterfaceType : java.util.Properties.class.getGenericInterfaces()) {
              // 输出派生类的类型
              Class<?>[] classes = resolveTypeParameters(java.util.Properties.class,
                  genericInterfaceType);
              System.out.print(genericInterfaceType + " = ");
              System.out.println(Arrays.toString(classes));
          }
      }
docs: 测试代码