a5565020edc171e43d550f7ace0a8dc6a80739e3
[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<PrimaryFound> SERIALIZABLE_CLASS = PrimaryFound.class;
14   private final String primaryPath;
15
16   public PrimaryFound(final String primaryPath) {
17     this.primaryPath = primaryPath;
18   }
19
20   public String getPrimaryPath() {
21     return primaryPath;
22   }
23
24   @Override
25   public boolean equals(final Object o) {
26     if (this == o) {
27         return true;
28     }
29     if (o == null || getClass() != o.getClass()) {
30         return false;
31     }
32
33     PrimaryFound that = (PrimaryFound) o;
34
35     if (!primaryPath.equals(that.primaryPath)) {
36         return false;
37     }
38
39     return true;
40   }
41
42   @Override
43   public int hashCode() {
44     return primaryPath.hashCode();
45   }
46
47   @Override
48   public String toString() {
49     return "PrimaryFound{" +
50             "primaryPath='" + primaryPath + '\'' +
51             '}';
52   }
53
54
55   @Override
56   public Object toSerializable() {
57     return  this;
58   }
59
60   public static PrimaryFound fromSerializable(final Object message){
61     return (PrimaryFound) message;
62   }
63 }