Class Tlds

java.lang.Object
google.registry.model.tld.Tlds

public final class Tlds extends Object
Utilities for finding and listing Tld entities.
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    Pass-through check that the specified TLD exists, otherwise throw an IAE.
    static String
    assertTldExists(String tld, String fmtMessage)
    Pass-through check that the TLD exists, otherwise throw using the given error format message.
    Pass-through check that every TLD in the given iterable exists, otherwise throw an IAE.
    static Optional<com.google.common.net.InternetDomainName>
    findTldForName(com.google.common.net.InternetDomainName domainName)
    Returns TLD which the domain name or hostname falls under, no matter how many levels of sublabels there are.
    static com.google.common.net.InternetDomainName
    findTldForNameOrThrow(com.google.common.net.InternetDomainName domainName)
    Returns the registered TLD which this domain name falls under, or throws an exception if no match exists.
    static com.google.common.collect.ImmutableSet<Tld>
    Returns the TLD entities themselves of the given type loaded fresh from the database.
    static com.google.common.collect.ImmutableSet<String>
     
    static com.google.common.collect.ImmutableSet<String>
     
    static boolean
    hasActiveBsaEnrollment(org.joda.time.DateTime now)
    Returns true if at least one TLD is enrolled now.
    static void
    Manually reset the static cache backing the methods on this class.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • resetCache

      public static void resetCache()
      Manually reset the static cache backing the methods on this class.
    • getTlds

      public static com.google.common.collect.ImmutableSet<String> getTlds()
    • getTldsOfType

      public static com.google.common.collect.ImmutableSet<String> getTldsOfType(Tld.TldType type)
    • getTldEntitiesOfType

      public static com.google.common.collect.ImmutableSet<Tld> getTldEntitiesOfType(Tld.TldType type)
      Returns the TLD entities themselves of the given type loaded fresh from the database.
    • assertTldExists

      public static String assertTldExists(String tld)
      Pass-through check that the specified TLD exists, otherwise throw an IAE.
    • assertTldExists

      public static String assertTldExists(String tld, String fmtMessage)
      Pass-through check that the TLD exists, otherwise throw using the given error format message.

      The specified TLD will be passed to the format message string.

    • assertTldsExist

      public static Iterable<String> assertTldsExist(Iterable<String> tlds)
      Pass-through check that every TLD in the given iterable exists, otherwise throw an IAE.
    • findTldForName

      public static Optional<com.google.common.net.InternetDomainName> findTldForName(com.google.common.net.InternetDomainName domainName)
      Returns TLD which the domain name or hostname falls under, no matter how many levels of sublabels there are.

      Note: This routine will only work on names under TLDs for which this registry is authoritative. To extract TLDs from domains (not hosts) that other registries control, use DomainNameUtils#getTldFromDomainName.

      Parameters:
      domainName - domain name or host name (but not TLD) under an authoritative TLD
      Returns:
      TLD or absent if domainName has no labels under an authoritative TLD
    • findTldForNameOrThrow

      public static com.google.common.net.InternetDomainName findTldForNameOrThrow(com.google.common.net.InternetDomainName domainName)
      Returns the registered TLD which this domain name falls under, or throws an exception if no match exists.
    • hasActiveBsaEnrollment

      public static boolean hasActiveBsaEnrollment(org.joda.time.DateTime now)
      Returns true if at least one TLD is enrolled now.