Clean up one usage of ForeignKeyIndex.mapToFkiClass()

Followup to []

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=154361061
This commit is contained in:
nickfelt 2017-04-26 16:26:15 -07:00 committed by Ben McIlwain
parent 40fa9ff022
commit 924e5e3e3a
2 changed files with 7 additions and 7 deletions

View file

@ -136,7 +136,7 @@ public class DeleteProberDataAction implements Runnable {
}
final Key<EppResourceIndex> eppIndex = Key.create(EppResourceIndex.create(domainKey));
final Key<ForeignKeyIndex<?>> fki = ForeignKeyIndex.createKey(domain);
final Key<? extends ForeignKeyIndex<?>> fki = ForeignKeyIndex.createKey(domain);
int entitiesDeleted = ofy().transact(new Work<Integer>() {
@Override

View file

@ -113,9 +113,8 @@ public abstract class ForeignKeyIndex<E extends EppResource> extends BackupGroup
public static <E extends EppResource> ForeignKeyIndex<E> create(
E resource, DateTime deletionTime) {
@SuppressWarnings("unchecked")
Class<ForeignKeyIndex<E>> fkiClass =
ForeignKeyIndex.mapToFkiClass((Class<E>) resource.getClass());
ForeignKeyIndex<E> instance = instantiate(fkiClass);
Class<E> resourceClass = (Class<E>) resource.getClass();
ForeignKeyIndex<E> instance = instantiate(mapToFkiClass(resourceClass));
instance.topReference = Key.create(resource);
instance.foreignKey = resource.getForeignKey();
instance.deletionTime = deletionTime;
@ -123,9 +122,10 @@ public abstract class ForeignKeyIndex<E extends EppResource> extends BackupGroup
}
/** Create a {@link ForeignKeyIndex} key for a resource. */
public static Key<ForeignKeyIndex<?>> createKey(EppResource resource) {
return Key.<ForeignKeyIndex<?>>create(
mapToFkiClass(resource.getClass()), resource.getForeignKey());
public static <E extends EppResource> Key<ForeignKeyIndex<E>> createKey(E resource) {
@SuppressWarnings("unchecked")
Class<E> resourceClass = (Class<E>) resource.getClass();
return Key.<ForeignKeyIndex<E>>create(mapToFkiClass(resourceClass), resource.getForeignKey());
}
/**