2 * Copyright (c) 2014 Cisco Systems, Inc. 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.example.messages;
10 import org.opendaylight.controller.cluster.raft.messages.Payload;
12 public final class KeyValue extends Payload {
13 private static final long serialVersionUID = 1L;
21 public KeyValue(final String key, final String value) {
26 public String getKey() {
30 public String getValue() {
36 return value.length() + key.length();
40 public int serializedSize() {
41 // Should be a better estimate
46 public String toString() {
47 return "KeyValue{" + "key='" + key + '\'' + ", value='" + value + '\'' + '}';
51 protected Object writeReplace() {
52 return new KVv1(value, key);