// check values in standard range, catching really stupid cases like -1
// this means that the second check will not hit trouble
int size = partial.size();
for (int i = 0; i < size; i++) {
int value = values[i];
DateTimeField field = partial.getField(i);
if (value < field.getMinimumValue()) {
throw new IllegalFieldValueException
(field.getType(), new Integer(value),
new Integer(field.getMinimumValue()), null);
}
if (value > field.getMaximumValue()) {
throw new IllegalFieldValueException
(field.getType(), new Integer(value),
null, new Integer(field.getMaximumValue()));
}
}
// check values in specific range, catching really odd cases like 30th Feb
for (int i = 0; i < size; i++) {
int value = values[i];
DateTimeField field = partial.getField(i);
if (value < field.getMinimumValue(partial, values)) {
throw new IllegalFieldValueException
(field.getType(), new Integer(value),
new Integer(field.getMinimumValue(partial, values)), null);
}
if (value > field.getMaximumValue(partial, values)) {
throw new IllegalFieldValueException
(field.getType(), new Integer(value),
null, new Integer(field.getMaximumValue(partial, values)));
}
}
}