Merge "Bug 809: Enhancements to the toaster example"
[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, refName;
12
13     public ServiceReference(String serviceInterfaceName, String refName) {
14         this.serviceInterfaceName = serviceInterfaceName;
15         this.refName = refName;
16     }
17
18     public String getServiceInterfaceQName() {
19         return serviceInterfaceName;
20     }
21
22     public String getRefName() {
23         return refName;
24     }
25
26     @Override
27     public boolean equals(Object o) {
28         if (this == o) {
29             return true;
30         }
31         if (o == null || getClass() != o.getClass()) {
32             return false;
33         }
34
35         ServiceReference that = (ServiceReference) o;
36
37         if (!refName.equals(that.refName)) {
38             return false;
39         }
40         if (!serviceInterfaceName.equals(that.serviceInterfaceName)) {
41             return false;
42         }
43
44         return true;
45     }
46
47     @Override
48     public int hashCode() {
49         int result = serviceInterfaceName.hashCode();
50         result = 31 * result + refName.hashCode();
51         return result;
52     }
53
54     @Override
55     public String toString() {
56         return "ServiceReference{" +
57                 "serviceInterfaceName='" + serviceInterfaceName + '\'' +
58                 ", refName='" + refName + '\'' +
59                 '}';
60     }
61 }