@Override
  public T validate(String fieldName, T value) throws ValidationException {
    if (value == null) {
      return null;
    }
    if (max.compareTo(value) < 0) {
      throw new ValidationException(fieldName, value, "must be at most " + max);
    }
    return value;
  }