@Test public void testDateIntervalConstraintHandleDate() throws ParseException { assertTrue(minInMaxEx.validate(new SimpleDateFormat("yyyy-MM-dd").parse(NOV3))); assertFalse(minInMaxEx.validate(new SimpleDateFormat("yyyy-MM-dd").parse(NOV1))); }
@Override public boolean validate(Object object) { if (object == null) { return true; } Long timeValue = ConstraintUtils.objectToTimeMillis(object); if (timeValue == null) { return false; } if (minTime != null) { if (timeValue < minTime.longValue()) { return false; } if (!includingMin && timeValue == minTime.longValue()) { return false; } } if (maxTime != null) { if (timeValue > maxTime.longValue()) { return false; } if (!includingMax && timeValue == maxTime.longValue()) { return false; } } return true; }
DateIntervalConstraint extends AbstractConstraint { @Override public boolean validate(Object object) { if (object == null) { return true; } Long timeValue = ConstraintUtils.objectToTimeMillis(object); if (timeValue == null) { return false; } if (minTime != null) { if (timeValue < minTime.longValue()) { return false; } if (!includingMin && timeValue == minTime.longValue()) { return false; } } if (maxTime != null) { if (timeValue > maxTime.longValue()) { return false; } if (!includingMax && timeValue == maxTime.longValue()) { return false; } } return true; } }
DateIntervalConstraint extends AbstractConstraint { @Override public boolean validate(Object object) { if (object == null) { return true; } Long timeValue = ConstraintUtils.objectToTimeMillis(object); if (timeValue == null) { return false; } if (minTime != null) { if (timeValue < minTime.longValue()) { return false; } if (!includingMin && timeValue == minTime.longValue()) { return false; } } if (maxTime != null) { if (timeValue > maxTime.longValue()) { return false; } if (!includingMax && timeValue == maxTime.longValue()) { return false; } } return true; } DateIntervalConstraint(Object minDate, boolean includingMin, Object maxDate, boolean includingMax); }
DateIntervalConstraint extends AbstractConstraint { @Override public boolean validate(Object object) { if (object == null) { return true; } Long timeValue = ConstraintUtils.objectToTimeMillis(object); if (timeValue == null) { return false; } if (minTime != null) { if (timeValue < minTime.longValue()) { return false; } if (!includingMin && timeValue == minTime.longValue()) { return false; } } if (maxTime != null) { if (timeValue > maxTime.longValue()) { return false; } if (!includingMax && timeValue == maxTime.longValue()) { return false; } } return true; } DateIntervalConstraint(Object minDate, boolean includingMin, Object maxDate, boolean includingMax); @Override boolean validate(Object object); @Override Description getDescription(); Long getMinTime(); Long getMaxTime(); boolean isIncludingMin(); boolean isIncludingMax(); @Override String getErrorMessage(Object invalidValue, Locale locale); @Override int hashCode(); @Override boolean equals(Object obj); }
DateIntervalConstraint extends AbstractConstraint { @Override public boolean validate(Object object) { if (object == null) { return true; } Long timeValue = ConstraintUtils.objectToTimeMillis(object); if (timeValue == null) { return false; } if (minTime != null) { if (timeValue < minTime.longValue()) { return false; } if (!includingMin && timeValue == minTime.longValue()) { return false; } } if (maxTime != null) { if (timeValue > maxTime.longValue()) { return false; } if (!includingMax && timeValue == maxTime.longValue()) { return false; } } return true; } DateIntervalConstraint(Object minDate, boolean includingMin, Object maxDate, boolean includingMax); @Override boolean validate(Object object); @Override Description getDescription(); Long getMinTime(); Long getMaxTime(); boolean isIncludingMin(); boolean isIncludingMax(); @Override String getErrorMessage(Object invalidValue, Locale locale); @Override int hashCode(); @Override boolean equals(Object obj);  }