@Override
  public T validate(String fieldName, T value) throws ValidationException {
    if (value == null) {
      return null;
    }
    if (!legalValues.contains(value)) {
      throw new ValidationException(fieldName, value, "must be one of " + legalValues);
    }
    return value;
  }