protected void setProperty(FacesBean bean, PropertyKey key, ValueExpression expression) {
    if (expression == null) return;

    if (expression.isLiteralText()) {
      bean.setProperty(key, expression.getValue(null));
    } else {
      bean.setValueExpression(key, expression);
    }
  }
  /**
   * Set a property of type java.lang.Number. If the value is an EL expression, it will be stored as
   * a ValueBinding. Otherwise, it will parsed with Integer.valueOf() or Double.valueOf() . Null
   * values are ignored.
   */
  protected void setNumberProperty(FacesBean bean, PropertyKey key, ValueExpression expression) {
    if (expression == null) return;

    if (expression.isLiteralText()) {
      Object value = expression.getValue(null);
      if (value != null) {
        if (value instanceof Number) {
          bean.setProperty(key, value);
        } else {
          String valueStr = value.toString();
          if (valueStr.indexOf('.') == -1) bean.setProperty(key, Integer.valueOf(valueStr));
          else bean.setProperty(key, Double.valueOf(valueStr));
        }
      }
    } else {
      bean.setValueExpression(key, expression);
    }
  }
  /**
   * Set a property of type java.util.Date. If the value is an EL expression, it will be stored as a
   * ValueBinding. Otherwise, it will parsed as an ISO 8601 date (yyyy-MM-dd) and the time
   * components (hour, min, second, millisecond) maximized. Null values are ignored.
   */
  protected void setMaxDateProperty(FacesBean bean, PropertyKey key, ValueExpression expression) {
    if (expression == null) return;

    if (expression.isLiteralText()) {
      Date d = _parseISODate(expression.getValue(null));
      Calendar c = Calendar.getInstance();
      TimeZone tz = RequestContext.getCurrentInstance().getTimeZone();
      if (tz != null) c.setTimeZone(tz);
      c.setTime(d);
      // Original value had 00:00:00 for hours,mins, seconds now maximize those
      // to get the latest time value for the date supplied.
      c.set(Calendar.HOUR_OF_DAY, 23);
      c.set(Calendar.MINUTE, 59);
      c.set(Calendar.SECOND, 59);
      c.set(Calendar.MILLISECOND, 999);
      bean.setProperty(key, c.getTime());
    } else {
      bean.setValueExpression(key, expression);
    }
  }