Migrate Guava Predicates.notNull to Objects.nonNull

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=179569444
This commit is contained in:
mcilwain 2017-12-19 10:10:20 -08:00 committed by Ben McIlwain
parent 633eb3179a
commit 0bb2e12a8a
7 changed files with 15 additions and 16 deletions

View file

@ -18,7 +18,6 @@ import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.collect.ImmutableList.toImmutableList;
import static google.registry.model.EppResourceUtils.projectResourceOntoBuilderAtTime;
import com.google.common.base.Predicates;
import com.google.common.collect.ImmutableList;
import com.googlecode.objectify.annotation.Entity;
import com.googlecode.objectify.annotation.IgnoreSave;
@ -31,6 +30,7 @@ import google.registry.model.annotations.ExternalMessagingName;
import google.registry.model.annotations.ReportedOn;
import google.registry.model.contact.PostalInfo.Type;
import google.registry.model.transfer.TransferData;
import java.util.Objects;
import java.util.Optional;
import java.util.stream.Stream;
import javax.xml.bind.annotation.XmlElement;
@ -175,7 +175,7 @@ public class ContactResource extends EppResource implements
@XmlElement(name = "postalInfo")
public ImmutableList<PostalInfo> getPostalInfosAsList() {
return Stream.of(localizedPostalInfo, internationalizedPostalInfo)
.filter(Predicates.notNull())
.filter(Objects::nonNull)
.collect(toImmutableList());
}

View file

@ -16,7 +16,6 @@ package google.registry.model.ofy;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkState;
import static com.google.common.base.Predicates.notNull;
import static com.google.common.collect.Maps.uniqueIndex;
import static com.googlecode.objectify.ObjectifyService.ofy;
import static google.registry.config.RegistryConfig.getBaseOfyRetryDuration;
@ -135,7 +134,7 @@ public class Ofy {
@Override
protected void handleDeletion(Iterable<Key<?>> keys) {
assertInTransaction();
checkState(Streams.stream(keys).allMatch(notNull()), "Can't delete a null key.");
checkState(Streams.stream(keys).allMatch(Objects::nonNull), "Can't delete a null key.");
checkProhibitedAnnotations(keys, NotBackedUp.class, VirtualEntity.class);
TRANSACTION_INFO.get().putDeletes(keys);
}
@ -167,7 +166,8 @@ public class Ofy {
@Override
protected void handleSave(Iterable<?> entities) {
assertInTransaction();
checkState(Streams.stream(entities).allMatch(notNull()), "Can't save a null entity.");
checkState(
Streams.stream(entities).allMatch(Objects::nonNull), "Can't save a null entity.");
checkProhibitedAnnotations(entities, NotBackedUp.class, VirtualEntity.class);
ImmutableMap<Key<?>, ?> keysToEntities = uniqueIndex(entities, Key::create);
TRANSACTION_INFO.get().putSaves(keysToEntities);