X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-clustering-commons%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fmessaging%2FSliceOptions.java;h=9ba69fb65580fdf4da1960960dbdb9031baa4669;hp=6bae647cb7a43a1ef000961b48333104f7f6857a;hb=3859df9beca8f13f1ff2b2744ed3470a1715bec3;hpb=083a04543a96ae862c48ccb4aaefc667f19d9f1e;ds=sidebyside diff --git a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/messaging/SliceOptions.java b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/messaging/SliceOptions.java index 6bae647cb7..9ba69fb655 100644 --- a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/messaging/SliceOptions.java +++ b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/messaging/SliceOptions.java @@ -7,9 +7,11 @@ */ package org.opendaylight.controller.cluster.messaging; +import static com.google.common.base.Preconditions.checkState; +import static java.util.Objects.requireNonNull; + import akka.actor.ActorRef; import akka.actor.ActorSelection; -import com.google.common.base.Preconditions; import java.io.Serializable; import java.util.function.Consumer; import org.opendaylight.controller.cluster.io.FileBackedOutputStream; @@ -174,23 +176,23 @@ public final class SliceOptions { public SliceOptions build() { sealed = true; - Preconditions.checkNotNull(identifier, "identifier must be set"); - Preconditions.checkNotNull(replyTo, "replyTo must be set"); - Preconditions.checkNotNull(onFailureCallback, "onFailureCallback must be set"); - Preconditions.checkState(fileBackedStream == null || message == null, + requireNonNull(identifier, "identifier must be set"); + requireNonNull(replyTo, "replyTo must be set"); + requireNonNull(onFailureCallback, "onFailureCallback must be set"); + checkState(fileBackedStream == null || message == null, "Only one of message and fileBackedStream can be set"); - Preconditions.checkState(!(fileBackedStream == null && message == null), + checkState(!(fileBackedStream == null && message == null), "One of message and fileBackedStream must be set"); - Preconditions.checkState(sendToRef == null || sendToSelection == null, + checkState(sendToRef == null || sendToSelection == null, "Only one of sendToRef and sendToSelection can be set"); - Preconditions.checkState(!(sendToRef == null && sendToSelection == null), + checkState(!(sendToRef == null && sendToSelection == null), "One of sendToRef and sendToSelection must be set"); return new SliceOptions(this); } protected void checkSealed() { - Preconditions.checkState(!sealed, "Builder is already sealed - further modifications are not allowed"); + checkState(!sealed, "Builder is already sealed - further modifications are not allowed"); } } }