Interface RegisteredDomain


  • public interface RegisteredDomain
    A domain that is registered under a "public suffix". The public suffix is a top-level domain under which names can be registered. For example, "com" and "co.uk" are public suffixes, and "example.com" and "example.co.uk" are registered domains.

    The primary purpose of this class is to determine if domains are safe to use in various use-cases.

    • Method Detail

      • name

        String name()
        Returns the name of the registered domain.
        Returns:
        the name of the registered domain
      • type

        RegisteredDomain.Type type()
        Returns the type of the registered domain.
        Returns:
        the type of the registered domain
      • publicSuffix

        String publicSuffix()
        Returns the public suffix of the registered domain.
        Returns:
        the public suffix of the registered domain
      • from

        static Optional<RegisteredDomain> from​(String domain)
        Returns an Optional<RegisteredDomain> representing the registered part of the specified domain.
        Parameters:
        domain - the domain name
        Returns:
        an Optional<RegisteredDomain>; the Optional is empty if the domain is unknown or not registerable
        Throws:
        NullPointerException - if domain is null