String performance and maintenability
[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 obj) {
20         if (this == obj) {
21             return true;
22         }
23         if (obj == null || getClass() != obj.getClass()) {
24             return false;
25         }
26
27         ShardManagerIdentifier that = (ShardManagerIdentifier) obj;
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         return "shardmanager-" + type;
43     }
44
45     public static Builder builder() {
46         return new Builder();
47     }
48
49     public static class Builder {
50         private String type;
51
52         public Builder type(String newType) {
53             this.type = newType;
54             return this;
55         }
56
57         public ShardManagerIdentifier build() {
58             return new ShardManagerIdentifier(this.type);
59         }
60
61     }
62 }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.