private boolean isSecondaryFieldInRange(BigDecimal field, TimeUnit unit) { // we should never get handed a negative field value assert field.compareTo(ZERO) >= 0; // YEAR and DAY can never be secondary units, // nor can unit be null. assert unit != null; switch (unit) { case YEAR: case DAY: default: throw Util.unexpected(unit); // Secondary field limits, as per section 4.6.3 of SQL2003 spec case MONTH: case HOUR: case MINUTE: case SECOND: return unit.isValidValue(field); } }
private boolean isSecondaryFieldInRange(BigDecimal field, TimeUnit unit) { // we should never get handed a negative field value assert field.compareTo(ZERO) >= 0; // YEAR and DAY can never be secondary units, // nor can unit be null. assert unit != null; switch (unit) { case YEAR: case DAY: default: throw Util.unexpected(unit); // Secondary field limits, as per section 4.6.3 of SQL2003 spec case MONTH: case HOUR: case MINUTE: case SECOND: return unit.isValidValue(field); } }