mirror of
https://github.com/google/nomulus.git
synced 2025-05-14 00:17:20 +02:00
Switch from Guava Optionals to Java 8 Optionals
This was a surprisingly involved change. Some of the difficulties included java.util.Optional purposely not being Serializable (so I had to move a few Optionals in mapreduce classes to @Nullable) and having to add the Truth Java8 extension library for assertion support. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=171863777
This commit is contained in:
parent
184b2b56ac
commit
c0f8da0c6e
581 changed files with 1325 additions and 932 deletions
|
@ -18,7 +18,6 @@ import static google.registry.util.CollectionUtils.nullSafeImmutableCopy;
|
|||
import static google.registry.util.CollectionUtils.nullToEmptyImmutableCopy;
|
||||
|
||||
import com.google.common.base.Ascii;
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import google.registry.model.ImmutableObject;
|
||||
|
@ -56,6 +55,7 @@ import google.registry.model.eppinput.ResourceCommand.ResourceCheck;
|
|||
import google.registry.model.eppinput.ResourceCommand.SingleResourceCommand;
|
||||
import google.registry.model.host.HostCommand;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
|
@ -107,12 +107,12 @@ public class EppInput extends ImmutableObject {
|
|||
return Optional.of(xmlSchemaAnnotation.xmlns()[0].prefix());
|
||||
}
|
||||
}
|
||||
return Optional.absent();
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
/** Returns whether this EppInput represents a command that operates on domain resources. */
|
||||
public boolean isDomainResourceType() {
|
||||
return getResourceType().or("").equals("domain");
|
||||
return getResourceType().orElse("").equals("domain");
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
@ -131,7 +131,7 @@ public class EppInput extends ImmutableObject {
|
|||
ResourceCommand resourceCommand = getResourceCommand();
|
||||
return resourceCommand instanceof SingleResourceCommand
|
||||
? Optional.of(((SingleResourceCommand) resourceCommand).getTargetId())
|
||||
: Optional.<String>absent();
|
||||
: Optional.<String>empty();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue