DomainValidator (Grails 3.2.3)
Date: 2016-11-10

Package: org.grails.validation.routines

## [Java] Class DomainValidator

- org.grails.validation.routines.DomainValidator

- All Implemented Interfaces and Traits:
    java.io.Serializable

      public class DomainValidator
      extends java.lang.Object

  Domain name validation routines.

  This validator provides methods for validating Internet domain names and top-level domains.

  Domain names are evaluated according to the standards RFC1034, section 3, and RFC1123, section 2.1. No accomodation is provided for the specialized needs of other applications; if the domain name has been URL-encoded, for example, validation will fail even though the equivalent plaintext version of the same name would have passed.

  Validation is also provided for top-level domains (TLDs) as defined and maintained by the Internet Assigned Numbers Authority (IANA):

  - isValidInfrastructureTld - validates infrastructure TLDs (`.arpa`, etc.)
  - isValidGenericTld - validates generic TLDs (`.com, .org`, etc.)
  - isValidCountryCodeTld - validates country code TLDs (`.us, .uk, .cn`, etc.)

  (NOTE: This class does not provide IP address lookup for domain names or methods to ensure that a given domain name matches a specific IP; see java.net.InetAddress for that functionality.)

  Since:
    Validator 1.4

- - ### Methods Summary

    Methods
    Type | Name and description
    --- | ---
    `static DomainValidator` | `getInstance()` Returns the singleton instance of this validator.
    `boolean` | `isValid(java.lang.String domain)` Returns true if the specified `String` parses as a valid domain name with a recognized top-level domain.
    `boolean` | `isValidCountryCodeTld(java.lang.String ccTld)` Returns true if the specified `String` matches any IANA-defined country code top-level domain.
    `boolean` | `isValidGenericTld(java.lang.String gTld)` Returns true if the specified `String` matches any IANA-defined generic top-level domain.
    `boolean` | `isValidInfrastructureTld(java.lang.String iTld)` Returns true if the specified `String` matches any IANA-defined infrastructure top-level domain.
    `boolean` | `isValidTld(java.lang.String tld)` Returns true if the specified `String` matches any IANA-defined top-level domain.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class java.lang.Object` | `java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()`

- - ### Method Detail

    - #### public static DomainValidator getInstance()

      Returns the singleton instance of this validator.

      Returns:
        the singleton instance of this validator

    - #### public boolean isValid(java.lang.String domain)

      Returns true if the specified `String` parses as a valid domain name with a recognized top-level domain. The parsing is case-sensitive.

      Parameters:
        `domain` - the parameter to check for domain name syntax
      Returns:
        true if the parameter is a valid domain name

    - #### public boolean isValidCountryCodeTld(java.lang.String ccTld)

      Returns true if the specified `String` matches any IANA-defined country code top-level domain. Leading dots are ignored if present. The search is case-sensitive.

      Parameters:
        `ccTld` - the parameter to check for country code TLD status
      Returns:
        true if the parameter is a country code TLD

    - #### public boolean isValidGenericTld(java.lang.String gTld)

      Returns true if the specified `String` matches any IANA-defined generic top-level domain. Leading dots are ignored if present. The search is case-sensitive.

      Parameters:
        `gTld` - the parameter to check for generic TLD status
      Returns:
        true if the parameter is a generic TLD

    - #### public boolean isValidInfrastructureTld(java.lang.String iTld)

      Returns true if the specified `String` matches any IANA-defined infrastructure top-level domain. Leading dots are ignored if present. The search is case-sensitive.

      Parameters:
        `iTld` - the parameter to check for infrastructure TLD status
      Returns:
        true if the parameter is an infrastructure TLD

    - #### public boolean isValidTld(java.lang.String tld)

      Returns true if the specified `String` matches any IANA-defined top-level domain. Leading dots are ignored if present. The search is case-sensitive.

      Parameters:
        `tld` - the parameter to check for TLD status
      Returns:
        true if the parameter is a TLD