code: public static Integer asInteger(Object value) {
      int intValue;
      switch (value.getClass().getCanonicalName()) {
        case "java.math.BigDecimal":
          intValue = ((BigDecimal) value).intValue();
          break;
        case "java.lang.Boolean":
          intValue = (Boolean) value ? 1 : 0;
          break;
        case "java.lang.Integer":
          intValue = (Integer) value;
          break;
        default:
          intValue = (Integer) value;
          break;
      }
      return intValue;
    }
docs: Transforms different objects (BigDecimal, Integer) to Integer.
  
  @param value
  The object to transform
  @return
  The double value