List of usage examples for com.google.common.net HostAndPort requireBracketsForIPv6
public HostAndPort requireBracketsForIPv6()
From source file:com.github.jcustenborder.kafka.connect.utils.config.validators.ValidHostAndPort.java
void validate(final String setting, final String input) { HostAndPort hostAndPort = HostAndPort.fromString(input); if (this.requireBracketsForIPv6) { hostAndPort = hostAndPort.requireBracketsForIPv6(); }/*from w w w. ja va 2s . c o m*/ if (null != this.defaultPort) { hostAndPort.withDefaultPort(this.defaultPort); } if (Strings.isNullOrEmpty(hostAndPort.getHostText())) { throw new ConfigException(String.format("'%s'(%s) host cannot be blank or null.", setting, input)); } if (this.portRequired && !hostAndPort.hasPort()) { throw new ConfigException(String.format("'%s'(%s) must specify a port.", setting, input)); } }