Package google.registry.model.tld
Class Registries
- java.lang.Object
-
- google.registry.model.tld.Registries
-
public final class Registries extends java.lang.Object
Utilities for finding and listingRegistry
entities.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
assertTldExists(java.lang.String tld)
Pass-through check that the specified TLD exists, otherwise throw an IAE.static java.lang.String
assertTldExists(java.lang.String tld, java.lang.String fmtMessage)
Pass-through check that the TLD exists, otherwise throw using the given error format message.static java.lang.Iterable<java.lang.String>
assertTldsExist(java.lang.Iterable<java.lang.String> tlds)
Pass-through check that every TLD in the given iterable exists, otherwise throw an IAE.static java.util.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<Registry>
getTldEntitiesOfType(Registry.TldType type)
Returns the Registry entities themselves of the given type loaded fresh from Datastore.static com.google.common.collect.ImmutableSet<java.lang.String>
getTlds()
static com.google.common.collect.ImmutableSet<java.lang.String>
getTldsOfType(Registry.TldType type)
static void
resetCache()
Manually reset the static cache backing the methods on this class.
-
-
-
Method Detail
-
resetCache
public static void resetCache()
Manually reset the static cache backing the methods on this class.
-
getTlds
public static com.google.common.collect.ImmutableSet<java.lang.String> getTlds()
-
getTldsOfType
public static com.google.common.collect.ImmutableSet<java.lang.String> getTldsOfType(Registry.TldType type)
-
getTldEntitiesOfType
public static com.google.common.collect.ImmutableSet<Registry> getTldEntitiesOfType(Registry.TldType type)
Returns the Registry entities themselves of the given type loaded fresh from Datastore.
-
assertTldExists
public static java.lang.String assertTldExists(java.lang.String tld)
Pass-through check that the specified TLD exists, otherwise throw an IAE.
-
assertTldExists
public static java.lang.String assertTldExists(java.lang.String tld, java.lang.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 java.lang.Iterable<java.lang.String> assertTldsExist(java.lang.Iterable<java.lang.String> tlds)
Pass-through check that every TLD in the given iterable exists, otherwise throw an IAE.
-
findTldForName
public static java.util.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.
-
-