/** * Constructor. * * @param field the field to wrap, like "year()". * @param type the field type this field actually uses * @param offset offset to add to field values * @param minValue minimum allowed value * @param maxValue maximum allowed value * @throws IllegalArgumentException if offset is zero */ public OffsetDateTimeField( DateTimeField field, DateTimeFieldType type, int offset, int minValue, int maxValue) { super(field, type); if (offset == 0) { throw new IllegalArgumentException("The offset cannot be zero"); } iOffset = offset; if (minValue < (field.getMinimumValue() + offset)) { iMin = field.getMinimumValue() + offset; } else { iMin = minValue; } if (maxValue > (field.getMaximumValue() + offset)) { iMax = field.getMaximumValue() + offset; } else { iMax = maxValue; } }