Browse Source

MINOR: Fix Embedded ConfigDef Validator toString issue (#6339)

`ConfigDef.embeddedValidator` should return an Anonymous Object instead of lambda so that we can have a useful `toString()` for methods such as `toRst`.

Reviewers: Jason Gustafson <jason@confluent.io>
pull/6656/head
Chase Walden 6 years ago committed by Jason Gustafson
parent
commit
626fbc60dd
  1. 11
      clients/src/main/java/org/apache/kafka/common/config/ConfigDef.java

11
clients/src/main/java/org/apache/kafka/common/config/ConfigDef.java

@ -1318,7 +1318,16 @@ public class ConfigDef { @@ -1318,7 +1318,16 @@ public class ConfigDef {
*/
private static Validator embeddedValidator(final String keyPrefix, final Validator base) {
if (base == null) return null;
return (name, value) -> base.ensureValid(name.substring(keyPrefix.length()), value);
return new Validator() {
public void ensureValid(String name, Object value) {
base.ensureValid(name.substring(keyPrefix.length()), value);
}
@Override
public String toString() {
return base.toString();
}
};
}
/**

Loading…
Cancel
Save