3455569ee8a579bc2cdfbe3a9fe401cb897b7317
[controller.git] / opendaylight / config / config-manager / src / main / java / org / opendaylight / controller / config / manager / impl / jmx / ServiceReference.java
1 /*
2  * Copyright (c) 2013 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 package org.opendaylight.controller.config.manager.impl.jmx;
9
10 public class ServiceReference {
11     private final String serviceInterfaceName;
12     private final String refName;
13
14     public ServiceReference(String serviceInterfaceName, String refName) {
15         this.serviceInterfaceName = serviceInterfaceName;
16         this.refName = refName;
17     }
18
19     public String getServiceInterfaceQName() {
20         return serviceInterfaceName;
21     }
22
23     public String getRefName() {
24         return refName;
25     }
26
27     @Override
28     public boolean equals(Object o) {
29         if (this == o) {
30             return true;
31         }
32         if (o == null || getClass() != o.getClass()) {
33             return false;
34         }
35
36         ServiceReference that = (ServiceReference) o;
37
38         if (!refName.equals(that.refName)) {
39             return false;
40         }
41         if (!serviceInterfaceName.equals(that.serviceInterfaceName)) {
42             return false;
43         }
44
45         return true;
46     }
47
48     @Override
49     public int hashCode() {
50         int result = serviceInterfaceName.hashCode();
51         result = 31 * result + refName.hashCode();
52         return result;
53     }
54
55     @Override
56     public String toString() {
57         return "ServiceReference{" +
58                 "serviceInterfaceName='" + serviceInterfaceName + '\'' +
59                 ", refName='" + refName + '\'' +
60                 '}';
61     }
62 }