Improve segmented journal actor metrics
[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(final String type) {
15         this.type = type;
16     }
17
18     @Override
19     public boolean equals(final Object obj) {
20         if (this == obj) {
21             return true;
22         }
23         if (obj == null || getClass() != obj.getClass()) {
24             return false;
25         }
26         return type.equals(((ShardManagerIdentifier) obj).type);
27     }
28
29     @Override
30     public int hashCode() {
31         return type.hashCode();
32     }
33
34     @Override public String toString() {
35         return "shardmanager-" + type;
36     }
37
38     public static Builder builder() {
39         return new Builder();
40     }
41
42     public static class Builder {
43         private String type;
44
45         public Builder type(final String newType) {
46             type = newType;
47             return this;
48         }
49
50         public ShardManagerIdentifier build() {
51             return new ShardManagerIdentifier(type);
52         }
53     }
54 }