wzx140 commented on code in PR #5637:
URL: https://github.com/apache/hudi/pull/5637#discussion_r882358849
##########
hudi-common/src/main/java/org/apache/hudi/common/config/ConfigProperty.java:
##########
@@ -95,33 +99,46 @@ Option<Function<HoodieConfig, Option<T>>> getInferFunc() {
return inferFunction;
}
+ public void checkValues(String value) {
+ if (validValues != null && !validValues.isEmpty() &&
!validValues.contains(value)) {
+ throw new IllegalArgumentException(
+ "The value of " + key + " should be one of "
+ + String.join(",", validValues) + ", but was " + value);
+ }
+ }
+
public List<String> getAlternatives() {
return Arrays.asList(alternatives);
}
public ConfigProperty<T> withDocumentation(String doc) {
Objects.requireNonNull(doc);
- return new ConfigProperty<>(key, defaultValue, doc, sinceVersion,
deprecatedVersion, inferFunction, alternatives);
+ return new ConfigProperty<>(key, defaultValue, doc, sinceVersion,
deprecatedVersion, inferFunction, validValues, alternatives);
+ }
+
+ public ConfigProperty<T> withValidValues(List<String> validValues) {
Review Comment:
fixed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]