Class PremiumList
- java.lang.Object
-
- google.registry.model.ImmutableObject
-
- google.registry.model.tld.label.BaseDomainLabelList<java.math.BigDecimal,PremiumList.PremiumEntry>
-
- google.registry.model.tld.label.PremiumList
-
- All Implemented Interfaces:
Buildable
,java.lang.Cloneable
@Entity public final class PremiumList extends BaseDomainLabelList<java.math.BigDecimal,PremiumList.PremiumEntry>
A premium list entity that is used to check domain label prices.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 premium 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
PremiumList.Builder
A builder for constructingPremiumList
objects, since they are immutable.static class
PremiumList.PremiumEntry
A premium list entry entity, persisted to Cloud SQL.-
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 PremiumList()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PremiumList.Builder
asBuilder()
org.joda.money.Money
convertAmountToMoney(java.math.BigDecimal amount)
Converts a rawBigDecimal
amount to aMoney
by applying the list's currency.com.google.common.hash.BloomFilter<java.lang.String>
getBloomFilter()
Returns a Bloom filter to determine whether a label might be premium, or is definitely not.org.joda.money.CurrencyUnit
getCurrency()
Returns theCurrencyUnit
used for this list.com.google.common.collect.ImmutableMap<java.lang.String,java.math.BigDecimal>
getLabelsToPrices()
Returns aMap
of domain labels to prices.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
-
getCurrency
public org.joda.money.CurrencyUnit getCurrency()
Returns theCurrencyUnit
used for this list.
-
getLabelsToPrices
public com.google.common.collect.ImmutableMap<java.lang.String,java.math.BigDecimal> getLabelsToPrices()
Returns aMap
of domain labels to prices.Note that this is lazily loaded and thus must be called inside a transaction. You generally should not be using this anyway as it's inefficient to load all of the PremiumEntry rows if you don't need them. To check prices, use
PremiumListDao.getPremiumPrice(java.lang.String, java.lang.String)
instead.
-
convertAmountToMoney
public org.joda.money.Money convertAmountToMoney(java.math.BigDecimal amount)
Converts a rawBigDecimal
amount to aMoney
by applying the list's currency.
-
getBloomFilter
public com.google.common.hash.BloomFilter<java.lang.String> getBloomFilter()
Returns a Bloom filter to determine whether a label might be premium, or is definitely not.If the domain label might be premium, then the next step is to check for the existence of a corresponding row in the PremiumListEntry table. Otherwise, we know for sure it's not premium, and no DB load is required.
-
refersToList
public boolean refersToList(Registry registry, java.lang.String name)
- Specified by:
refersToList
in classBaseDomainLabelList<java.math.BigDecimal,PremiumList.PremiumEntry>
-
asBuilder
public PremiumList.Builder asBuilder()
-
-