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 com.google.common.base.Preconditions;
12 import org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages;
14 public class PrimaryNotFound implements SerializableMessage {
15 public static final Class SERIALIZABLE_CLASS = ShardManagerMessages.PrimaryNotFound.class;
17 private final String shardName;
19 public PrimaryNotFound(String shardName){
21 Preconditions.checkNotNull(shardName, "shardName should not be null");
23 this.shardName = shardName;
27 public boolean equals(Object o) {
28 if (this == o) return true;
29 if (o == null || getClass() != o.getClass()) return false;
31 PrimaryNotFound that = (PrimaryNotFound) o;
33 if (shardName != null ? !shardName.equals(that.shardName) : that.shardName != null) return false;
39 public int hashCode() {
40 return shardName != null ? shardName.hashCode() : 0;
44 public Object toSerializable() {
45 return ShardManagerMessages.PrimaryNotFound.newBuilder().setShardName(shardName).build();
48 public static PrimaryNotFound fromSerializable(Object message){
49 return new PrimaryNotFound(((ShardManagerMessages.PrimaryNotFound)message).getShardName());