protected boolean isValidDomain(String domain){
  Matcher ipDomainMatcher=IP_DOMAIN_PATTERN.matcher(domain);
  if (ipDomainMatcher.matches()) {
    InetAddressValidator inetAddressValidator=InetAddressValidator.getInstance();
    return inetAddressValidator.isValid(ipDomainMatcher.group(1));
  }
  DomainValidator domainValidator=DomainValidator.getInstance(allowLocal);
  return domainValidator.isValid(domain) || domainValidator.isValidTld(domain);
}

protected boolean isValidDomain ( String domain ) { Matcher ipDomainMatcher = IP_DOMAIN_PATTERN . matcher ( domain ) ; if ( ipDomainMatcher . matches ( ) ) { InetAddressValidator inetAddressValidator = InetAddressValidator . getInstance ( ) ; return inetAddressValidator . isValid ( ipDomainMatcher . group ( 1 ) ) ; } DomainValidator domainValidator = DomainValidator . getInstance ( allowLocal ) ; return domainValidator . isValid ( domain ) || domainValidator . isValidTld ( domain ) ; }
returns true if the domain component of an email address is valid .
