2 * Copyright (c) 2017 Inocybe Technologies and others. All rights reserved.
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
8 package org.opendaylight.controller.cluster.raft.base.messages;
10 import com.google.common.base.Preconditions;
11 import java.io.Externalizable;
12 import java.io.IOException;
13 import java.io.ObjectInput;
14 import java.io.ObjectOutput;
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.
20 * @author Thomas Pantelis
22 public abstract class EmptyExternalizableProxy implements Externalizable {
23 private static final long serialVersionUID = 1L;
25 private final Object readResolveTo;
27 protected EmptyExternalizableProxy(Object readResolveTo) {
28 this.readResolveTo = Preconditions.checkNotNull(readResolveTo);
32 public void writeExternal(ObjectOutput out) throws IOException {
36 public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
39 protected Object readResolve() {