bipinprasad commented on a change in pull request #3215: Storm3585 - New
compact Constraint config including maxCoLocationCnt
URL: https://github.com/apache/storm/pull/3215#discussion_r388000583
##########
File path:
storm-client/src/jvm/org/apache/storm/validation/ConfigValidation.java
##########
@@ -850,6 +852,128 @@ public void validateField(String name, Object o) {
}
}
+ public static class CustomIsExactlyOneOfValidators extends Validator {
+ private Class<?>[] subValidators;
+ private List<String> validatorClassNames;
+
+ public CustomIsExactlyOneOfValidators(Map<String, Object> params) {
+ this.subValidators = (Class<?>[])
params.get(ConfigValidationAnnotations.ValidatorParams.VALUE_VALIDATOR_CLASSES);
+ this.validatorClassNames =
Arrays.asList(subValidators).stream().map(x ->
x.getName()).collect(Collectors.toList());
+ }
+
+ @Override
+ public void validateField(String name, Object o) {
+ if (o == null) {
+ throw new IllegalArgumentException("Field " + name + " must be
set.");
Review comment:
Allow null in RasConstraintsTypeValidator and CustomIsExactlyOneOfValidators.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services