Ejemplo n.º 1
0
    /**
     * Param Types should be extactly match, think about the below cases. String getName(int age);
     * String getName(String name);
     *
     * @param args
     * @param paramTypes
     * @return
     */
    private boolean checkParamTypes(Object[] args, Class<?>[] paramTypes) {
      int len1 = (args == null ? 0 : paramTypes.length);
      int len2 = (args == null ? 0 : args.length);

      if (len1 == len2) {
        for (int i = 0; i < len1; i++) {
          Class<?> argsType = args[i].getClass();
          if (TypeUtil.isPrimaryClass(argsType)) {
            argsType = TypeUtil.getPrimitiveClass(argsType);
          }
          if (!paramTypes[i].isAssignableFrom(argsType)) {
            return false;
          }
        }
        return true;
      }
      return false;
    }
Ejemplo n.º 2
0
    protected boolean isPrimitiveValue(Object value) {
      Class<?> clazz = TypeUtil.getPrimitiveClass(value.getClass());

      return clazz.isPrimitive() || value instanceof String || value instanceof Date;
    }