Class ReservedList
- java.lang.Object
-
- google.registry.model.ImmutableObject
-
- google.registry.model.tld.label.BaseDomainLabelList<ReservationType,ReservedList.ReservedListEntry>
-
- google.registry.model.tld.label.ReservedList
-
- All Implemented Interfaces:
Buildable
,java.lang.Cloneable
@Entity public final class ReservedList extends BaseDomainLabelList<ReservationType,ReservedList.ReservedListEntry>
A list of reserved domain labels that are blocked from being registered for various reasons.Note that the primary key of this entity is
BaseDomainLabelList.revisionId
, which is auto-generated by the database. So, if a retry of insertion happens after the previous attempt unexpectedly succeeds, we will end up with having two exact same reserved lists that differ only by revisionId. This is fine though, because we only use the list with the highest revisionId.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ReservedList.Builder
A builder for constructingReservedList
objects, since they are immutable.static class
ReservedList.ReservedListEntry
A reserved list entry entity, persisted to the database, that represents a single label and its reservation type.-
Nested classes/interfaces inherited from class google.registry.model.ImmutableObject
ImmutableObject.DoNotHydrate, ImmutableObject.IgnoredInDiffableMap, ImmutableObject.Insignificant
-
Nested classes/interfaces inherited from interface google.registry.model.Buildable
Buildable.GenericBuilder<S,B extends Buildable.GenericBuilder<?,?>>, Buildable.Overlayable<T>
-
-
Field Summary
-
Fields inherited from class google.registry.model.ImmutableObject
hashCode
-
-
Constructor Summary
Constructors Constructor Description ReservedList()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ReservedList.Builder
asBuilder()
static java.util.Optional<ReservedList>
get(java.lang.String listName)
Gets a ReservedList by name using the caching layer.java.util.Optional<ReservationType>
getReservationInList(java.lang.String label)
Gets theReservationType
of a label in a single ReservedList, or returns an absent Optional if none exists in the list.static com.google.common.collect.ImmutableSet<ReservationType>
getReservationTypes(java.lang.String label, java.lang.String tld)
Queries the set of all reserved lists associated with the specified TLD and returns the reservation types of the label.com.google.common.collect.ImmutableMap<java.lang.String,ReservedList.ReservedListEntry>
getReservedListEntries()
Returns aMap
of domain labels toReservedList.ReservedListEntry
.boolean
getShouldPublish()
Returns whether this reserved list is included in the concatenated list of reserved terms published to Google Drive for viewing by registrars.boolean
isInUse()
Determines whether the ReservedList is in use on any Registryprotected boolean
refersToList(Registry registry, java.lang.String name)
-
Methods inherited from class google.registry.model.tld.label.BaseDomainLabelList
getCreationTimestamp, getName, getReferencingTlds, getRevisionId, parse, splitOnComment
-
Methods inherited from class google.registry.model.ImmutableObject
clone, cloneEmptyToNull, createVKey, equals, getSignificantFields, hashCode, toDiffableFieldMap, toHydratedString, toString, toStringHelper
-
-
-
-
Method Detail
-
refersToList
protected boolean refersToList(Registry registry, java.lang.String name)
- Specified by:
refersToList
in classBaseDomainLabelList<ReservationType,ReservedList.ReservedListEntry>
-
isInUse
public boolean isInUse()
Determines whether the ReservedList is in use on any Registry
-
getShouldPublish
public boolean getShouldPublish()
Returns whether this reserved list is included in the concatenated list of reserved terms published to Google Drive for viewing by registrars.
-
getReservedListEntries
public com.google.common.collect.ImmutableMap<java.lang.String,ReservedList.ReservedListEntry> getReservedListEntries()
Returns aMap
of domain labels toReservedList.ReservedListEntry
.Note that this involves a database fetch of a potentially large number of elements and should be avoided unless necessary.
-
get
public static java.util.Optional<ReservedList> get(java.lang.String listName)
Gets a ReservedList by name using the caching layer.- Returns:
- An Optional<ReservedList> that has a value if a reserved list exists by the given name, or absent if not.
- Throws:
com.google.common.util.concurrent.UncheckedExecutionException
- if some other error occurs while trying to load the ReservedList from the cache or database.
-
getReservationTypes
public static com.google.common.collect.ImmutableSet<ReservationType> getReservationTypes(java.lang.String label, java.lang.String tld)
Queries the set of all reserved lists associated with the specified TLD and returns the reservation types of the label.If the label is in none of the lists, it returns an empty set.
-
getReservationInList
public java.util.Optional<ReservationType> getReservationInList(java.lang.String label)
Gets theReservationType
of a label in a single ReservedList, or returns an absent Optional if none exists in the list.Note that this logic is significantly less complicated than the
getReservationTypes(java.lang.String, java.lang.String)
methods, which are applicable to an entire Registry, and need to check across multiple reserved lists.
-
asBuilder
public ReservedList.Builder asBuilder()
-
-