Package google.registry.model.tld
Class Tlds
java.lang.Object
google.registry.model.tld.Tlds
Utilities for finding and listing
Tld
entities.-
Method Summary
Modifier and TypeMethodDescriptionstatic String
assertTldExists
(String tld) 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.assertTldsExist
(Iterable<String> tlds) 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> getTlds()
static com.google.common.collect.ImmutableSet
<String> getTldsOfType
(Tld.TldType type) static boolean
hasActiveBsaEnrollment
(org.joda.time.DateTime now) Returns true if at least one TLD is enrollednow
.static void
Manually reset the static cache backing the methods on this class.
-
Method Details
-
resetCache
public static void resetCache()Manually reset the static cache backing the methods on this class. -
getTlds
-
getTldsOfType
-
getTldEntitiesOfType
Returns the TLD entities themselves of the given type loaded fresh from the database. -
assertTldExists
Pass-through check that the specified TLD exists, otherwise throw an IAE. -
assertTldExists
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
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 enrollednow
.
-