Do not use protobuf serialization for FindPrimary and it's responses
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / messages / PrimaryFound.java
1 /*
2  * Copyright (c) 2014 Cisco Systems, Inc. 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
9 package org.opendaylight.controller.cluster.datastore.messages;
10
11
12 public class PrimaryFound implements SerializableMessage {
13   public static final Class SERIALIZABLE_CLASS = PrimaryFound.class;
14   private final String primaryPath;
15
16   public PrimaryFound(String primaryPath) {
17     this.primaryPath = primaryPath;
18   }
19
20   public String getPrimaryPath() {
21     return primaryPath;
22   }
23
24   @Override
25   public boolean equals(Object o) {
26     if (this == o) return true;
27     if (o == null || getClass() != o.getClass()) return false;
28
29     PrimaryFound that = (PrimaryFound) o;
30
31     if (!primaryPath.equals(that.primaryPath)) return false;
32
33     return true;
34   }
35
36   @Override
37   public int hashCode() {
38     return primaryPath.hashCode();
39   }
40
41   @Override
42   public String toString() {
43     return "PrimaryFound{" +
44             "primaryPath='" + primaryPath + '\'' +
45             '}';
46   }
47
48
49   @Override
50   public Object toSerializable() {
51     return  this;
52   }
53
54   public static PrimaryFound fromSerializable(Object message){
55     return (PrimaryFound) message;
56   }
57 }