Reduce JSR305 proliferation
[controller.git] / opendaylight / md-sal / cds-access-api / src / main / java / org / opendaylight / controller / cluster / access / ABIVersion.java
index 0e40e6e1cb2dd3e3ac06140ddea0f4677aba0c2c..3eddf3eb564f29c7b20b7ae06cec560793dc6144 100644 (file)
@@ -7,13 +7,14 @@
  */
 package org.opendaylight.controller.cluster.access;
 
+import static com.google.common.base.Preconditions.checkArgument;
+
 import com.google.common.annotations.Beta;
 import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Preconditions;
 import java.io.DataInput;
 import java.io.DataOutput;
 import java.io.IOException;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.concepts.WritableObject;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -25,7 +26,7 @@ import org.slf4j.LoggerFactory;
  */
 @Beta
 public enum ABIVersion implements WritableObject {
-    // NOTE: enumeration values need to be sorted in asceding order of their version to keep Comparable working
+    // NOTE: enumeration values need to be sorted in ascending order of their version to keep Comparable working
 
     /**
      * Version which is older than any other version. This version exists purely for testing purposes.
@@ -50,7 +51,7 @@ public enum ABIVersion implements WritableObject {
     private final short value;
 
     ABIVersion(final int intVersion) {
-        Preconditions.checkArgument(intVersion >= 0 && intVersion <= 65535);
+        checkArgument(intVersion >= 0 && intVersion <= 65535);
         value = (short) intVersion;
     }
 
@@ -69,7 +70,7 @@ public enum ABIVersion implements WritableObject {
      *
      * @return Current {@link ABIVersion}
      */
-    public static @Nonnull ABIVersion current() {
+    public static @NonNull ABIVersion current() {
         return BORON;
     }
 
@@ -77,23 +78,23 @@ public enum ABIVersion implements WritableObject {
      * Return the {@link ABIVersion} corresponding to an unsigned short integer. This method is provided for callers
      * which provide their own recovery strategy in case of version incompatibility.
      *
-     * @param s Short integer as returned from {@link #shortValue()}
+     * @param value Short integer as returned from {@link #shortValue()}
      * @return {@link ABIVersion}
      * @throws FutureVersionException if the specified integer identifies a future version
      * @throws PastVersionException if the specified integer identifies a past version which is no longer supported
      */
-    public static @Nonnull ABIVersion valueOf(final short s) throws FutureVersionException, PastVersionException {
-        switch (Short.toUnsignedInt(s)) {
+    public static @NonNull ABIVersion valueOf(final short value) throws FutureVersionException, PastVersionException {
+        switch (Short.toUnsignedInt(value)) {
             case 0:
             case 1:
             case 2:
             case 3:
             case 4:
-                throw new PastVersionException(s, BORON);
+                throw new PastVersionException(value, BORON);
             case 5:
                 return BORON;
             default:
-                throw new FutureVersionException(s, BORON);
+                throw new FutureVersionException(value, BORON);
         }
     }
 
@@ -110,7 +111,7 @@ public enum ABIVersion implements WritableObject {
      * @return An {@link ABIVersion}
      * @throws IOException If read fails or an unsupported version is encountered
      */
-    public static @Nonnull ABIVersion readFrom(final @Nonnull DataInput in) throws IOException {
+    public static @NonNull ABIVersion readFrom(final @NonNull DataInput in) throws IOException {
         final short s = in.readShort();
         try {
             return valueOf(s);
@@ -119,7 +120,7 @@ public enum ABIVersion implements WritableObject {
         }
     }
 
-    public static ABIVersion inexactReadFrom(final @Nonnull DataInput in) throws IOException {
+    public static @NonNull ABIVersion inexactReadFrom(final @NonNull DataInput in) throws IOException {
         final short onWire = in.readShort();
         try {
             return ABIVersion.valueOf(onWire);