Reduce JSR305 proliferation
[controller.git] / opendaylight / md-sal / cds-access-api / src / main / java / org / opendaylight / controller / cluster / access / concepts / Request.java
index 2f5cb4f4becaa84e1fd6677d93dd7d2375d27442..093a3f1eb0c1cdedb4c957cfdb81c85b639ac6f2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016, 2017 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -7,11 +7,12 @@
  */
 package org.opendaylight.controller.cluster.access.concepts;
 
+import static java.util.Objects.requireNonNull;
+
 import akka.actor.ActorRef;
 import com.google.common.annotations.Beta;
 import com.google.common.base.MoreObjects.ToStringHelper;
-import com.google.common.base.Preconditions;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.controller.cluster.access.ABIVersion;
 import org.opendaylight.yangtools.concepts.WritableIdentifier;
 
@@ -27,16 +28,16 @@ import org.opendaylight.yangtools.concepts.WritableIdentifier;
 @Beta
 public abstract class Request<T extends WritableIdentifier, C extends Request<T, C>> extends Message<T, C> {
     private static final long serialVersionUID = 1L;
-    private final ActorRef replyTo;
+    private final @NonNull ActorRef replyTo;
 
-    protected Request(final @Nonnull T target, final long sequence, final @Nonnull ActorRef replyTo) {
+    protected Request(final @NonNull T target, final long sequence, final @NonNull ActorRef replyTo) {
         super(target, sequence);
-        this.replyTo = Preconditions.checkNotNull(replyTo);
+        this.replyTo = requireNonNull(replyTo);
     }
 
-    protected Request(final @Nonnull C request, final @Nonnull ABIVersion version) {
+    protected Request(final @NonNull C request, final @NonNull ABIVersion version) {
         super(request, version);
-        this.replyTo = Preconditions.checkNotNull(request.getReplyTo());
+        this.replyTo = requireNonNull(request.getReplyTo());
     }
 
     /**
@@ -44,7 +45,7 @@ public abstract class Request<T extends WritableIdentifier, C extends Request<T,
      *
      * @return Original requestor
      */
-    public final @Nonnull ActorRef getReplyTo() {
+    public final @NonNull ActorRef getReplyTo() {
         return replyTo;
     }
 
@@ -54,7 +55,7 @@ public abstract class Request<T extends WritableIdentifier, C extends Request<T,
      * @param cause Failure cause
      * @return {@link RequestFailure} corresponding to this request
      */
-    public abstract @Nonnull RequestFailure<T, ?> toRequestFailure(final @Nonnull RequestException cause);
+    public abstract @NonNull RequestFailure<T, ?> toRequestFailure(@NonNull RequestException cause);
 
     @Override
     protected ToStringHelper addToStringAttributes(final ToStringHelper toStringHelper) {
@@ -62,5 +63,5 @@ public abstract class Request<T extends WritableIdentifier, C extends Request<T,
     }
 
     @Override
-    protected abstract AbstractRequestProxy<T, C> externalizableProxy(@Nonnull ABIVersion version);
+    protected abstract AbstractRequestProxy<T, C> externalizableProxy(ABIVersion version);
 }