code: public static boolean instanceOf(Object data, Class type) {
          //这里有一个事实,即参数data必定是非原生类型,即使传入时是原生类型,它也被java强制转化为Object非原生了.
          //here we rely on the jdk default behavior of packing primitive type parameter into packed type,
          //which means that if you passe an int to the data parameter, right here within this method,
          //you will always get an Integer object.
          if (type.isInstance(data)) {
              return true;
          }
          if (data == null) {
              return false;
          }
          if (type.isPrimitive()) {
              if (type == int.class) {
                  type = Integer.class;
              } else if (type == long.class) {
                  type = Long.class;
              } else if (type == short.class) {
                  type = Short.class;
              } else if (type == double.class) {
                  type = Double.class;
              } else if (type == float.class) {
                  type = Float.class;
              } else if (type == char.class) {
                  type = Character.class;
              } else if (type == byte.class) {
                  type = Byte.class;
              } else if (type == boolean.class) {
                  type = Boolean.class;
              }
          }
          return type.isInstance(data);
      }
docs: <p>judge the given data object is instance of the given type or not.</p>
  
  @param data the data object.
  @param type the given class to test.
  @return true or false as described.