public static boolean getBoolean(String field, Map data, boolean required)
      throws GeneralException {

    Object o = null;

    if (required) {

      o = TypeEncoder.checkTypeAndNotNull(field, data, Boolean.class);

    } else {

      o = data.get(field);

      if (o == null) {

        return false;
      }

      if (!Boolean.class.isAssignableFrom(o.getClass())) {

        throw new GeneralException(
            "Expected type for: "
                + field
                + " to be: "
                + Number.class.getName()
                + ", is: "
                + o.getClass().getName());
      }
    }

    return (Boolean) o;
  }
  public static Date getDate(String field, Map data, boolean required) throws GeneralException {

    Object o = null;

    if (required) {

      o = TypeEncoder.checkTypeAndNotNull(field, data, Number.class);

    } else {

      o = data.get(field);

      if (o == null) {

        return null;
      }

      if (!Number.class.isAssignableFrom(o.getClass())) {

        throw new GeneralException(
            "Expected type for: "
                + field
                + " to be: "
                + Number.class.getName()
                + ", is: "
                + o.getClass().getName());
      }
    }

    return new Date(((Number) o).longValue());
  }