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
9 package org.opendaylight.controller.cluster.datastore.messages;
11 import org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages;
13 public class PrimaryFound implements SerializableMessage {
14 public static final Class SERIALIZABLE_CLASS = ShardManagerMessages.PrimaryFound.class;
15 private final String primaryPath;
17 public PrimaryFound(String primaryPath) {
18 this.primaryPath = primaryPath;
21 public String getPrimaryPath() {
26 public boolean equals(Object o) {
27 if (this == o) return true;
28 if (o == null || getClass() != o.getClass()) return false;
30 PrimaryFound that = (PrimaryFound) o;
32 if (!primaryPath.equals(that.primaryPath)) return false;
38 public int hashCode() {
39 return primaryPath.hashCode();
43 public String toString() {
44 return "PrimaryFound{" +
45 "primaryPath='" + primaryPath + '\'' +
51 public Object toSerializable() {
52 return ShardManagerMessages.PrimaryFound.newBuilder().setPrimaryPath(primaryPath).build();
55 public static PrimaryFound fromSerializable(Object message){
56 return new PrimaryFound(((ShardManagerMessages.PrimaryFound)message).getPrimaryPath());