showuon commented on a change in pull request #11837: URL: https://github.com/apache/kafka/pull/11837#discussion_r826787871
########## File path: clients/src/main/java/org/apache/kafka/common/config/ConfigDef.java ########## @@ -1121,6 +1121,27 @@ public String toString() { } } + public static class ListSize implements Validator { + final int maxSize; + + private ListSize(final int maxSize) { + this.maxSize = maxSize; + } + + public static ListSize atMostOfSize(final int maxSize) { + return new ListSize(maxSize); + } + + @Override + public void ensureValid(final String name, final Object value) { + @SuppressWarnings("unchecked") + List<String> values = (List<String>) value; + if (values.size() > maxSize) { + throw new ConfigException(name, value, "exceeds maximum list size of [" + maxSize + "]."); Review comment: I'm not quite sure if the `value` will output the list strings. Should we use `values` instead? -- 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: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org