Merge "Optimizations, Monitoring and Logging"
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / identifiers / ShardManagerIdentifier.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.identifiers;
10
11 public class ShardManagerIdentifier {
12     private final String type;
13
14     public ShardManagerIdentifier(String type) {
15         this.type = type;
16     }
17
18     @Override
19     public boolean equals(Object o) {
20         if (this == o) {
21             return true;
22         }
23         if (o == null || getClass() != o.getClass()) {
24             return false;
25         }
26
27         ShardManagerIdentifier that = (ShardManagerIdentifier) o;
28
29         if (!type.equals(that.type)) {
30             return false;
31         }
32
33         return true;
34     }
35
36     @Override
37     public int hashCode() {
38         return type.hashCode();
39     }
40
41     @Override public String toString() {
42         StringBuilder builder = new StringBuilder();
43         builder.append("shardmanager-").append(type);
44         return builder.toString();
45     }
46
47     public static Builder builder(){
48         return new Builder();
49     }
50
51     public static class Builder {
52         private String type;
53
54         public Builder type(String type){
55             this.type = type;
56             return this;
57         }
58
59         public ShardManagerIdentifier build(){
60             return new ShardManagerIdentifier(this.type);
61         }
62
63     }
64 }