Remove ABIVersion.MAGNESIUM
[controller.git] / opendaylight / md-sal / cds-access-api / src / main / java / org / opendaylight / controller / cluster / access / concepts / MemberName.java
index 3cc2b0c6398ec59bde76877648e40bc7e4e71c27..daab643f8a6e13647d7e92554718a49e70b14570 100644 (file)
@@ -11,60 +11,21 @@ import static com.google.common.base.Preconditions.checkArgument;
 import static com.google.common.base.Verify.verifyNotNull;
 import static java.util.Objects.requireNonNull;
 
-import com.google.common.annotations.Beta;
 import com.google.common.base.MoreObjects;
 import com.google.common.base.Strings;
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import java.io.DataInput;
 import java.io.DataOutput;
-import java.io.Externalizable;
 import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
 import java.nio.charset.StandardCharsets;
 import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.concepts.WritableIdentifier;
 
 /**
  * Type-safe encapsulation of a cluster member name.
- *
- * @author Robert Varga
  */
-@Beta
 public final class MemberName implements Comparable<MemberName>, WritableIdentifier {
-    private static final class Proxy implements Externalizable {
-        private static final long serialVersionUID = 1L;
-        private byte[] serialized;
-
-        // checkstyle flags the public modifier as redundant however it is explicitly needed for Java serialization to
-        // be able to create instances via reflection.
-        @SuppressWarnings("checkstyle:RedundantModifier")
-        public Proxy() {
-            // For Externalizable
-        }
-
-        Proxy(final byte[] serialized) {
-            this.serialized = requireNonNull(serialized);
-        }
-
-        @Override
-        public void writeExternal(final ObjectOutput out) throws IOException {
-            out.writeInt(serialized.length);
-            out.write(serialized);
-        }
-
-        @Override
-        public void readExternal(final ObjectInput in) throws IOException {
-            serialized = new byte[in.readInt()];
-            in.readFully(serialized);
-        }
-
-        private Object readResolve() {
-            // TODO: consider caching instances here
-            return new MemberName(new String(serialized, StandardCharsets.UTF_8), serialized);
-        }
-    }
-
+    @java.io.Serial
     private static final long serialVersionUID = 1L;
 
     private final @NonNull String name;
@@ -140,7 +101,8 @@ public final class MemberName implements Comparable<MemberName>, WritableIdentif
         return local;
     }
 
+    @java.io.Serial
     Object writeReplace() {
-        return new Proxy(getSerialized());
+        return new MN(getSerialized());
     }
 }