Add ABIVersion.CHLORINE_SR2
[controller.git] / opendaylight / md-sal / cds-access-api / src / main / java / org / opendaylight / controller / cluster / access / ABIVersion.java
index 84eb8f6c97f3222c91f9fab6037156c9cd42618e..b4278f7d7909a6c0f7f3ed9dfe59893b4672e38f 100644 (file)
@@ -76,6 +76,16 @@ public enum ABIVersion implements WritableObject {
             return NormalizedNodeStreamVersion.MAGNESIUM;
         }
     },
+    /**
+     * Revised ABI version. The messages remain the same as {@link #MAGNESIUM}, the serialization proxies in use are
+     * flat objects without any superclasses.
+     */
+    CHLORINE_SR2(9) {
+        @Override
+        public NormalizedNodeStreamVersion getStreamVersion() {
+            return NormalizedNodeStreamVersion.MAGNESIUM;
+        }
+    },
 
     /**
      * Version which is newer than any other version. This version exists purely for testing purposes.
@@ -132,10 +142,22 @@ public enum ABIVersion implements WritableObject {
             case 6 -> NEON_SR2;
             case 7 -> SODIUM_SR1;
             case 8 -> MAGNESIUM;
-            default -> throw new FutureVersionException(value, MAGNESIUM);
+            case 9 -> CHLORINE_SR2;
+            default -> throw new FutureVersionException(value, CHLORINE_SR2);
         };
     }
 
+    /**
+     * Return {@code true} if this version is earier than some {@code other} version.
+     *
+     * @param other Other {@link ABIVersion}
+     * @return {@code true} if {@code other is later}
+     * @throws NullPointerException if {@code other} is null
+     */
+    public boolean lt(final @NonNull ABIVersion other) {
+        return compareTo(other) < 0;
+    }
+
     @Override
     public void writeTo(final DataOutput out) throws IOException {
         out.writeShort(value);