Merge "Simplify method isMutualExclusive in Subnet. Remove redundant 'if' statements."
[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 getServiceInterfaceName() {
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) return true;
29         if (o == null || getClass() != o.getClass()) return false;
30
31         ServiceReference that = (ServiceReference) o;
32
33         if (!refName.equals(that.refName)) return false;
34         if (!serviceInterfaceName.equals(that.serviceInterfaceName)) return false;
35
36         return true;
37     }
38
39     @Override
40     public int hashCode() {
41         int result = serviceInterfaceName.hashCode();
42         result = 31 * result + refName.hashCode();
43         return result;
44     }
45 }