public Builder limitResultsBefore(Date end) { if (end == null) { return this; } FormField formField = new FormField(FORM_FIELD_END); formField.addValue(end); formFields.put(formField.getVariable(), formField); FormField startFormField = formFields.get(FORM_FIELD_START); if (startFormField != null) { Date start; try { start = startFormField.getFirstValueAsDate(); } catch (ParseException e) { throw new IllegalStateException(e); } if (end.getTime() <= start.getTime()) { throw new IllegalArgumentException("Given end date (" + end + ") is before the existing start date (" + start + ')'); } } return this; }
public Builder limitResultsSince(Date start) { if (start == null) { return this; } FormField formField = new FormField(FORM_FIELD_START); formField.addValue(start); formFields.put(formField.getVariable(), formField); FormField endFormField = formFields.get(FORM_FIELD_END); if (endFormField != null) { Date end; try { end = endFormField.getFirstValueAsDate(); } catch (ParseException e) { throw new IllegalStateException(e); } if (end.getTime() <= start.getTime()) { throw new IllegalArgumentException("Given start date (" + start + ") is after the existing end date (" + end + ')'); } } return this; }
public Builder limitResultsBefore(Date end) { if (end == null) { return this; } FormField formField = new FormField(FORM_FIELD_END); formField.addValue(end); formFields.put(formField.getVariable(), formField); FormField startFormField = formFields.get(FORM_FIELD_START); if (startFormField != null) { Date start; try { start = startFormField.getFirstValueAsDate(); } catch (ParseException e) { throw new IllegalStateException(e); } if (end.getTime() <= start.getTime()) { throw new IllegalArgumentException("Given end date (" + end + ") is before the existing start date (" + start + ')'); } } return this; }
public Builder limitResultsSince(Date start) { if (start == null) { return this; } FormField formField = new FormField(FORM_FIELD_START); formField.addValue(start); formFields.put(formField.getVariable(), formField); FormField endFormField = formFields.get(FORM_FIELD_END); if (endFormField != null) { Date end; try { end = endFormField.getFirstValueAsDate(); } catch (ParseException e) { throw new IllegalStateException(e); } if (end.getTime() <= start.getTime()) { throw new IllegalArgumentException("Given start date (" + start + ") is after the existing end date (" + end + ')'); } } return this; }