mirror of
https://github.com/google/nomulus.git
synced 2025-05-19 18:59:35 +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
|
@ -62,7 +62,7 @@ final class JSchSshSession implements Closeable {
|
|||
RdeUploadUrl url = RdeUploadUrl.create(uri);
|
||||
logger.info("Connecting to SSH endpoint: " + url);
|
||||
Session session = jsch.getSession(
|
||||
url.getUser().or("domain-registry"),
|
||||
url.getUser().orElse("domain-registry"),
|
||||
url.getHost(),
|
||||
url.getPort());
|
||||
if (url.getPass().isPresent()) {
|
||||
|
|
|
@ -15,14 +15,19 @@
|
|||
package google.registry.rde;
|
||||
|
||||
import com.google.auto.value.AutoValue;
|
||||
import com.google.common.base.Optional;
|
||||
import google.registry.model.common.Cursor.CursorType;
|
||||
import google.registry.model.rde.RdeMode;
|
||||
import java.io.Serializable;
|
||||
import java.util.Optional;
|
||||
import javax.annotation.Nullable;
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.Duration;
|
||||
|
||||
/** Container representing a single RDE or BRDA XML escrow deposit that needs to be created. */
|
||||
/**
|
||||
* Container representing a single RDE or BRDA XML escrow deposit that needs to be created.
|
||||
*
|
||||
* <p>There are some {@code @Nullable} fields here because Optionals aren't Serializable.
|
||||
*/
|
||||
@AutoValue
|
||||
public abstract class PendingDeposit implements Serializable {
|
||||
|
||||
|
@ -44,22 +49,26 @@ public abstract class PendingDeposit implements Serializable {
|
|||
public abstract RdeMode mode();
|
||||
|
||||
/** The cursor type to update (not used in manual operation). */
|
||||
public abstract Optional<CursorType> cursor();
|
||||
@Nullable
|
||||
public abstract CursorType cursor();
|
||||
|
||||
/** Amount of time to increment the cursor (not used in manual operation). */
|
||||
public abstract Optional<Duration> interval();
|
||||
@Nullable
|
||||
public abstract Duration interval();
|
||||
|
||||
/**
|
||||
* Subdirectory of bucket/manual in which files should be placed, including a trailing slash (used
|
||||
* only in manual operation).
|
||||
*/
|
||||
public abstract Optional<String> directoryWithTrailingSlash();
|
||||
@Nullable
|
||||
public abstract String directoryWithTrailingSlash();
|
||||
|
||||
/**
|
||||
* Revision number for generated files; if absent, use the next available in the sequence (used
|
||||
* only in manual operation).
|
||||
*/
|
||||
public abstract Optional<Integer> revision();
|
||||
@Nullable
|
||||
public abstract Integer revision();
|
||||
|
||||
static PendingDeposit create(
|
||||
String tld, DateTime watermark, RdeMode mode, CursorType cursor, Duration interval) {
|
||||
|
@ -68,10 +77,10 @@ public abstract class PendingDeposit implements Serializable {
|
|||
tld,
|
||||
watermark,
|
||||
mode,
|
||||
Optional.of(cursor),
|
||||
Optional.of(interval),
|
||||
Optional.<String>absent(),
|
||||
Optional.<Integer>absent());
|
||||
cursor,
|
||||
interval,
|
||||
null,
|
||||
null);
|
||||
}
|
||||
|
||||
static PendingDeposit createInManualOperation(
|
||||
|
@ -79,15 +88,15 @@ public abstract class PendingDeposit implements Serializable {
|
|||
DateTime watermark,
|
||||
RdeMode mode,
|
||||
String directoryWithTrailingSlash,
|
||||
Optional<Integer> revision) {
|
||||
@Nullable Integer revision) {
|
||||
return new AutoValue_PendingDeposit(
|
||||
true,
|
||||
tld,
|
||||
watermark,
|
||||
mode,
|
||||
Optional.<CursorType>absent(),
|
||||
Optional.<Duration>absent(),
|
||||
Optional.of(directoryWithTrailingSlash),
|
||||
null,
|
||||
null,
|
||||
directoryWithTrailingSlash,
|
||||
revision);
|
||||
}
|
||||
|
||||
|
|
|
@ -23,11 +23,11 @@ import static google.registry.request.RequestParameters.extractSetOfDatetimePara
|
|||
import static google.registry.request.RequestParameters.extractSetOfParameters;
|
||||
|
||||
import com.google.appengine.api.taskqueue.Queue;
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
import google.registry.request.Parameter;
|
||||
import java.util.Optional;
|
||||
import javax.inject.Named;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import org.joda.time.DateTime;
|
||||
|
|
|
@ -22,7 +22,6 @@ import static google.registry.xml.ValidationMode.STRICT;
|
|||
import static javax.servlet.http.HttpServletResponse.SC_NO_CONTENT;
|
||||
|
||||
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 com.google.common.collect.ImmutableSetMultimap;
|
||||
|
@ -47,6 +46,7 @@ import google.registry.request.Response;
|
|||
import google.registry.request.auth.Auth;
|
||||
import google.registry.util.Clock;
|
||||
import google.registry.util.FormattingLogger;
|
||||
import java.util.Optional;
|
||||
import javax.inject.Inject;
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.Duration;
|
||||
|
@ -328,7 +328,7 @@ public final class RdeStagingAction implements Runnable {
|
|||
watermark,
|
||||
mode,
|
||||
directoryWithTrailingSlash,
|
||||
revision));
|
||||
revision.orElse(null)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,6 @@ import static google.registry.model.ofy.ObjectifyService.ofy;
|
|||
|
||||
import com.google.appengine.tools.mapreduce.Mapper;
|
||||
import com.google.auto.value.AutoValue;
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.ImmutableSetMultimap;
|
||||
|
@ -37,6 +36,7 @@ import google.registry.model.registrar.Registrar;
|
|||
import google.registry.xml.ValidationMode;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
/** Mapper for {@link RdeStagingAction}. */
|
||||
|
@ -119,10 +119,9 @@ public final class RdeStagingMapper extends Mapper<EppResource, PendingDeposit,
|
|||
|| resource instanceof HostResource)) {
|
||||
continue;
|
||||
}
|
||||
for (DepositFragment fragment
|
||||
: fragmenter.marshal(pending.watermark(), pending.mode()).asSet()) {
|
||||
emit(pending, fragment);
|
||||
}
|
||||
fragmenter
|
||||
.marshal(pending.watermark(), pending.mode())
|
||||
.ifPresent(fragment -> emit(pending, fragment));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -146,7 +145,7 @@ public final class RdeStagingMapper extends Mapper<EppResource, PendingDeposit,
|
|||
}
|
||||
EppResource resource = resourceAtTimes.get(watermark).now();
|
||||
if (resource == null) {
|
||||
result = Optional.absent();
|
||||
result = Optional.empty();
|
||||
cache.put(WatermarkModePair.create(watermark, RdeMode.FULL), result);
|
||||
cache.put(WatermarkModePair.create(watermark, RdeMode.THIN), result);
|
||||
return result;
|
||||
|
|
|
@ -55,6 +55,7 @@ import java.io.OutputStreamWriter;
|
|||
import java.io.Writer;
|
||||
import java.security.Security;
|
||||
import java.util.Iterator;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.Callable;
|
||||
import javax.inject.Inject;
|
||||
import org.bouncycastle.jce.provider.BouncyCastleProvider;
|
||||
|
@ -129,12 +130,14 @@ public final class RdeStagingReducer extends Reducer<PendingDeposit, DepositFrag
|
|||
final RdeMode mode = key.mode();
|
||||
final String tld = key.tld();
|
||||
final DateTime watermark = key.watermark();
|
||||
final int revision = key.revision().or(RdeRevision.getNextRevision(tld, watermark, mode));
|
||||
final int revision =
|
||||
Optional.ofNullable(key.revision())
|
||||
.orElse(RdeRevision.getNextRevision(tld, watermark, mode));
|
||||
String id = RdeUtil.timestampToId(watermark);
|
||||
String prefix = RdeNamingUtils.makeRydeFilename(tld, watermark, mode, 1, revision);
|
||||
if (key.manual()) {
|
||||
checkState(key.directoryWithTrailingSlash().isPresent(), "Manual subdirectory not specified");
|
||||
prefix = "manual/" + key.directoryWithTrailingSlash().get() + prefix;
|
||||
checkState(key.directoryWithTrailingSlash() != null, "Manual subdirectory not specified");
|
||||
prefix = "manual/" + key.directoryWithTrailingSlash() + prefix;
|
||||
}
|
||||
GcsFilename xmlFilename = new GcsFilename(bucket, prefix + ".xml.ghostryde");
|
||||
GcsFilename xmlLengthFilename = new GcsFilename(bucket, prefix + ".xml.length");
|
||||
|
@ -228,16 +231,16 @@ public final class RdeStagingReducer extends Reducer<PendingDeposit, DepositFrag
|
|||
public void vrun() {
|
||||
Registry registry = Registry.get(tld);
|
||||
DateTime position = getCursorTimeOrStartOfTime(
|
||||
ofy().load().key(Cursor.createKey(key.cursor().get(), registry)).now());
|
||||
checkState(key.interval().isPresent(), "Interval must be present");
|
||||
DateTime newPosition = key.watermark().plus(key.interval().get());
|
||||
ofy().load().key(Cursor.createKey(key.cursor(), registry)).now());
|
||||
checkState(key.interval() != null, "Interval must be present");
|
||||
DateTime newPosition = key.watermark().plus(key.interval());
|
||||
if (!position.isBefore(newPosition)) {
|
||||
logger.warning("Cursor has already been rolled forward.");
|
||||
return;
|
||||
}
|
||||
verify(position.equals(key.watermark()),
|
||||
"Partial ordering of RDE deposits broken: %s %s", position, key);
|
||||
ofy().save().entity(Cursor.create(key.cursor().get(), newPosition, registry)).now();
|
||||
ofy().save().entity(Cursor.create(key.cursor(), newPosition, registry)).now();
|
||||
logger.infofmt("Rolled forward %s on %s cursor to %s", key.cursor(), tld, newPosition);
|
||||
RdeRevision.saveRevision(tld, watermark, mode, revision);
|
||||
if (mode == RdeMode.FULL) {
|
||||
|
|
|
@ -18,12 +18,12 @@ import static com.google.common.base.Preconditions.checkArgument;
|
|||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static com.google.common.base.Strings.isNullOrEmpty;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URI;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.annotation.concurrent.Immutable;
|
||||
|
||||
|
@ -69,7 +69,7 @@ final class RdeUploadUrl implements Comparable<RdeUploadUrl> {
|
|||
public Optional<String> getUser() {
|
||||
String userInfo = uri.getUserInfo();
|
||||
if (isNullOrEmpty(userInfo)) {
|
||||
return Optional.absent();
|
||||
return Optional.empty();
|
||||
}
|
||||
int idx = userInfo.indexOf(':');
|
||||
if (idx != -1) {
|
||||
|
@ -83,13 +83,13 @@ final class RdeUploadUrl implements Comparable<RdeUploadUrl> {
|
|||
public Optional<String> getPass() {
|
||||
String userInfo = uri.getUserInfo();
|
||||
if (isNullOrEmpty(userInfo)) {
|
||||
return Optional.absent();
|
||||
return Optional.empty();
|
||||
}
|
||||
int idx = userInfo.indexOf(':');
|
||||
if (idx != -1) {
|
||||
return Optional.of(userInfo.substring(idx + 1));
|
||||
} else {
|
||||
return Optional.absent();
|
||||
return Optional.empty();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -112,7 +112,7 @@ final class RdeUploadUrl implements Comparable<RdeUploadUrl> {
|
|||
public Optional<String> getPath() {
|
||||
String path = uri.getPath();
|
||||
if (isNullOrEmpty(path) || path.equals("/")) {
|
||||
return Optional.absent();
|
||||
return Optional.empty();
|
||||
} else {
|
||||
return Optional.of(path.substring(1));
|
||||
}
|
||||
|
@ -134,7 +134,7 @@ final class RdeUploadUrl implements Comparable<RdeUploadUrl> {
|
|||
result += String.format(":%d", getPort());
|
||||
}
|
||||
result += "/";
|
||||
result += getPath().or("");
|
||||
result += getPath().orElse("");
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@ import com.google.appengine.tools.cloudstorage.GcsService;
|
|||
import com.google.appengine.tools.cloudstorage.GcsServiceFactory;
|
||||
import com.google.appengine.tools.cloudstorage.RetryParams;
|
||||
import com.google.appengine.tools.mapreduce.Mapper;
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.googlecode.objectify.VoidWork;
|
||||
import google.registry.config.RegistryConfig.Config;
|
||||
|
@ -39,6 +38,7 @@ import google.registry.util.SystemClock;
|
|||
import google.registry.xjc.JaxbFragment;
|
||||
import google.registry.xjc.rdecontact.XjcRdeContact;
|
||||
import google.registry.xjc.rdecontact.XjcRdeContactElement;
|
||||
import java.util.Optional;
|
||||
import javax.inject.Inject;
|
||||
|
||||
/**
|
||||
|
|
|
@ -24,7 +24,6 @@ import com.google.appengine.tools.cloudstorage.GcsServiceFactory;
|
|||
import com.google.appengine.tools.cloudstorage.RetryParams;
|
||||
import com.google.appengine.tools.mapreduce.Input;
|
||||
import com.google.appengine.tools.mapreduce.InputReader;
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import google.registry.config.RegistryConfig.ConfigModule;
|
||||
import google.registry.gcs.GcsUtils;
|
||||
|
@ -35,6 +34,7 @@ import google.registry.xjc.rdecontact.XjcRdeContactElement;
|
|||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* A MapReduce {@link Input} that imports {@link ContactResource} objects from an escrow file.
|
||||
|
@ -68,7 +68,7 @@ public class RdeContactInput extends Input<JaxbFragment<XjcRdeContactElement>> {
|
|||
|
||||
public RdeContactInput(Optional<Integer> mapShards, String importBucketName,
|
||||
String importFileName) {
|
||||
this.numReaders = mapShards.or(DEFAULT_READERS);
|
||||
this.numReaders = mapShards.orElse(DEFAULT_READERS);
|
||||
this.importBucketName = importBucketName;
|
||||
this.importFileName = importFileName;
|
||||
}
|
||||
|
|
|
@ -32,7 +32,6 @@ import com.google.appengine.tools.cloudstorage.GcsService;
|
|||
import com.google.appengine.tools.cloudstorage.GcsServiceFactory;
|
||||
import com.google.appengine.tools.cloudstorage.RetryParams;
|
||||
import com.google.appengine.tools.mapreduce.Mapper;
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.googlecode.objectify.VoidWork;
|
||||
|
@ -60,6 +59,7 @@ import google.registry.util.SystemClock;
|
|||
import google.registry.xjc.JaxbFragment;
|
||||
import google.registry.xjc.rdedomain.XjcRdeDomain;
|
||||
import google.registry.xjc.rdedomain.XjcRdeDomainElement;
|
||||
import java.util.Optional;
|
||||
import javax.inject.Inject;
|
||||
import org.joda.money.Money;
|
||||
import org.joda.time.DateTime;
|
||||
|
|
|
@ -24,7 +24,6 @@ import com.google.appengine.tools.cloudstorage.GcsServiceFactory;
|
|||
import com.google.appengine.tools.cloudstorage.RetryParams;
|
||||
import com.google.appengine.tools.mapreduce.Input;
|
||||
import com.google.appengine.tools.mapreduce.InputReader;
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import google.registry.config.RegistryConfig.ConfigModule;
|
||||
import google.registry.gcs.GcsUtils;
|
||||
|
@ -35,6 +34,7 @@ import google.registry.xjc.rdedomain.XjcRdeDomainElement;
|
|||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* A MapReduce {@link Input} that imports {@link DomainResource} objects from an escrow file.
|
||||
|
@ -68,7 +68,7 @@ public class RdeDomainInput extends Input<JaxbFragment<XjcRdeDomainElement>> {
|
|||
|
||||
public RdeDomainInput(
|
||||
Optional<Integer> mapShards, String importBucketName, String importFileName) {
|
||||
this.numReaders = mapShards.or(DEFAULT_READERS);
|
||||
this.numReaders = mapShards.orElse(DEFAULT_READERS);
|
||||
this.importBucketName = importBucketName;
|
||||
this.importFileName = importFileName;
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@ import com.google.appengine.tools.cloudstorage.GcsService;
|
|||
import com.google.appengine.tools.cloudstorage.GcsServiceFactory;
|
||||
import com.google.appengine.tools.cloudstorage.RetryParams;
|
||||
import com.google.appengine.tools.mapreduce.Mapper;
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.googlecode.objectify.VoidWork;
|
||||
import google.registry.config.RegistryConfig.Config;
|
||||
|
@ -39,6 +38,7 @@ import google.registry.util.SystemClock;
|
|||
import google.registry.xjc.JaxbFragment;
|
||||
import google.registry.xjc.rdehost.XjcRdeHost;
|
||||
import google.registry.xjc.rdehost.XjcRdeHostElement;
|
||||
import java.util.Optional;
|
||||
import javax.inject.Inject;
|
||||
|
||||
/**
|
||||
|
|
|
@ -22,7 +22,6 @@ import com.google.appengine.tools.cloudstorage.GcsServiceFactory;
|
|||
import com.google.appengine.tools.cloudstorage.RetryParams;
|
||||
import com.google.appengine.tools.mapreduce.Input;
|
||||
import com.google.appengine.tools.mapreduce.InputReader;
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import google.registry.config.RegistryConfig.ConfigModule;
|
||||
import google.registry.gcs.GcsUtils;
|
||||
|
@ -33,6 +32,7 @@ import google.registry.xjc.rdehost.XjcRdeHostElement;
|
|||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* A MapReduce {@link Input} that imports {@link HostResource} objects from an escrow file.
|
||||
|
@ -67,7 +67,7 @@ public class RdeHostInput extends Input<JaxbFragment<XjcRdeHostElement>> {
|
|||
|
||||
public RdeHostInput(Optional<Integer> mapShards, String importBucketName,
|
||||
String importFileName) {
|
||||
this.numReaders = mapShards.or(DEFAULT_READERS);
|
||||
this.numReaders = mapShards.orElse(DEFAULT_READERS);
|
||||
checkArgument(numReaders > 0, "Number of shards must be greater than zero");
|
||||
this.importBucketName = importBucketName;
|
||||
this.importFileName = importFileName;
|
||||
|
|
|
@ -23,7 +23,6 @@ import static google.registry.util.PipelineUtils.createJobPath;
|
|||
import static java.util.stream.Collectors.joining;
|
||||
|
||||
import com.google.appengine.tools.mapreduce.Mapper;
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.net.InternetDomainName;
|
||||
import com.googlecode.objectify.Key;
|
||||
|
@ -43,6 +42,7 @@ import google.registry.util.FormattingLogger;
|
|||
import google.registry.xjc.JaxbFragment;
|
||||
import google.registry.xjc.rdehost.XjcRdeHost;
|
||||
import google.registry.xjc.rdehost.XjcRdeHostElement;
|
||||
import java.util.Optional;
|
||||
import javax.inject.Inject;
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
|
@ -191,7 +191,7 @@ public class RdeHostLinkAction implements Runnable {
|
|||
Optional<InternetDomainName> tld = findTldForName(hostName);
|
||||
// out of zone hosts cannot be linked
|
||||
if (!tld.isPresent()) {
|
||||
return Optional.absent();
|
||||
return Optional.empty();
|
||||
}
|
||||
// This is a subordinate host
|
||||
String domainName =
|
||||
|
|
|
@ -18,7 +18,6 @@ import static com.google.common.base.Preconditions.checkArgument;
|
|||
import static google.registry.util.PreconditionsUtils.checkArgumentNotNull;
|
||||
|
||||
import com.google.common.base.Joiner;
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import google.registry.xjc.rdecontact.XjcRdeContact;
|
||||
import google.registry.xjc.rdecontact.XjcRdeContactElement;
|
||||
|
@ -41,6 +40,7 @@ import java.io.Closeable;
|
|||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Arrays;
|
||||
import java.util.Optional;
|
||||
import javax.annotation.concurrent.NotThreadSafe;
|
||||
import javax.xml.bind.JAXBContext;
|
||||
import javax.xml.bind.JAXBException;
|
||||
|
@ -116,31 +116,31 @@ public class RdeParser implements Closeable {
|
|||
}
|
||||
|
||||
public Long getDomainCount() {
|
||||
return Optional.fromNullable(counts.get(RDE_DOMAIN_URI)).or(0L);
|
||||
return Optional.ofNullable(counts.get(RDE_DOMAIN_URI)).orElse(0L);
|
||||
}
|
||||
|
||||
public Long getHostCount() {
|
||||
return Optional.fromNullable(counts.get(RDE_HOST_URI)).or(0L);
|
||||
return Optional.ofNullable(counts.get(RDE_HOST_URI)).orElse(0L);
|
||||
}
|
||||
|
||||
public Long getContactCount() {
|
||||
return Optional.fromNullable(counts.get(RDE_CONTACT_URI)).or(0L);
|
||||
return Optional.ofNullable(counts.get(RDE_CONTACT_URI)).orElse(0L);
|
||||
}
|
||||
|
||||
public Long getRegistrarCount() {
|
||||
return Optional.fromNullable(counts.get(RDE_REGISTRAR_URI)).or(0L);
|
||||
return Optional.ofNullable(counts.get(RDE_REGISTRAR_URI)).orElse(0L);
|
||||
}
|
||||
|
||||
public Long getIdnCount() {
|
||||
return Optional.fromNullable(counts.get(RDE_IDN_URI)).or(0L);
|
||||
return Optional.ofNullable(counts.get(RDE_IDN_URI)).orElse(0L);
|
||||
}
|
||||
|
||||
public Long getNndnCount() {
|
||||
return Optional.fromNullable(counts.get(RDE_NNDN_URI)).or(0L);
|
||||
return Optional.ofNullable(counts.get(RDE_NNDN_URI)).orElse(0L);
|
||||
}
|
||||
|
||||
public Long getEppParamsCount() {
|
||||
return Optional.fromNullable(counts.get(RDE_EPP_PARAMS_URI)).or(0L);
|
||||
return Optional.ofNullable(counts.get(RDE_EPP_PARAMS_URI)).orElse(0L);
|
||||
}
|
||||
|
||||
private RdeHeader(XjcRdeHeader header) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue