Bump mdsal to 11.0.4
[controller.git] / opendaylight / md-sal / sal-akka-raft / src / main / java / org / opendaylight / controller / cluster / raft / base / messages / EmptyExternalizableProxy.java
1 /*
2  * Copyright (c) 2017 Inocybe Technologies and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.controller.cluster.raft.base.messages;
9
10 import static java.util.Objects.requireNonNull;
11
12 import java.io.Externalizable;
13 import java.io.ObjectInput;
14 import java.io.ObjectOutput;
15
16 /**
17  * Abstract base that implements Externalizable with no-op methods that is intended for classes that use the
18  * externalizable proxy pattern but have no data to serialize and read-resolve to a static instance.
19  *
20  * @author Thomas Pantelis
21  */
22 @Deprecated(since = "7.0.0", forRemoval = true)
23 public abstract class EmptyExternalizableProxy implements Externalizable {
24     private static final long serialVersionUID = 1L;
25
26     private final Object readResolveTo;
27
28     protected EmptyExternalizableProxy(final Object readResolveTo) {
29         this.readResolveTo = requireNonNull(readResolveTo);
30     }
31
32     @Override
33     public void writeExternal(final ObjectOutput out) {
34     }
35
36     @Override
37     public void readExternal(final ObjectInput in) {
38     }
39
40     protected Object readResolve() {
41         return readResolveTo;
42     }
43 }