mirror of
https://github.com/google/nomulus.git
synced 2025-08-11 20:19:37 +02:00
Remove key references from BaseDomainLabelList (#1239)
This commit is contained in:
parent
65ae5f4a30
commit
886cfba6bc
3 changed files with 7 additions and 12 deletions
|
@ -164,16 +164,12 @@ public abstract class BaseDomainLabelList<T extends Comparable<?>, R extends Dom
|
||||||
|
|
||||||
/** Gets the names of the tlds that reference this list. */
|
/** Gets the names of the tlds that reference this list. */
|
||||||
public final ImmutableSet<String> getReferencingTlds() {
|
public final ImmutableSet<String> getReferencingTlds() {
|
||||||
Key<? extends BaseDomainLabelList<?, ?>> key = Key.create(this);
|
return getTlds().stream()
|
||||||
return getTlds()
|
.filter((tld) -> refersToList(Registry.get(tld), name))
|
||||||
.stream()
|
|
||||||
.filter((tld) -> refersToKey(Registry.get(tld), key))
|
|
||||||
.collect(toImmutableSet());
|
.collect(toImmutableSet());
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(b/193043636): Refactor this class to no longer use key references
|
protected abstract boolean refersToList(Registry registry, String name);
|
||||||
protected abstract boolean refersToKey(
|
|
||||||
Registry registry, Key<? extends BaseDomainLabelList<?, ?>> key);
|
|
||||||
|
|
||||||
protected static <R> Optional<R> getFromCache(String listName, LoadingCache<String, R> cache) {
|
protected static <R> Optional<R> getFromCache(String listName, LoadingCache<String, R> cache) {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -282,8 +282,8 @@ public final class PremiumList extends BaseDomainLabelList<Money, PremiumList.Pr
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean refersToKey(Registry registry, Key<? extends BaseDomainLabelList<?, ?>> key) {
|
public boolean refersToList(Registry registry, String name) {
|
||||||
return Objects.equals(registry.getPremiumListName().orElse(null), key.getName());
|
return Objects.equals(registry.getPremiumListName().orElse(null), name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -33,7 +33,6 @@ import com.google.common.cache.LoadingCache;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.common.util.concurrent.UncheckedExecutionException;
|
import com.google.common.util.concurrent.UncheckedExecutionException;
|
||||||
import com.googlecode.objectify.Key;
|
|
||||||
import com.googlecode.objectify.annotation.Embed;
|
import com.googlecode.objectify.annotation.Embed;
|
||||||
import com.googlecode.objectify.annotation.Entity;
|
import com.googlecode.objectify.annotation.Entity;
|
||||||
import com.googlecode.objectify.annotation.Mapify;
|
import com.googlecode.objectify.annotation.Mapify;
|
||||||
|
@ -185,8 +184,8 @@ public final class ReservedList
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean refersToKey(Registry registry, Key<? extends BaseDomainLabelList<?, ?>> key) {
|
protected boolean refersToList(Registry registry, String name) {
|
||||||
return registry.getReservedListNames().contains(key.getName());
|
return registry.getReservedListNames().contains(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Determines whether the ReservedList is in use on any Registry */
|
/** Determines whether the ReservedList is in use on any Registry */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue