Merge "Reuse PEM provider in netconf-testtool."
[controller.git] / opendaylight / config / yang-jmx-generator / src / main / java / org / opendaylight / controller / config / yangjmxgenerator / attribute / Dependency.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.yangjmxgenerator.attribute;
9
10 import org.opendaylight.controller.config.yangjmxgenerator.ServiceInterfaceEntry;
11
12 public class Dependency {
13     private final ServiceInterfaceEntry sie;
14     private final boolean mandatory;
15
16     public Dependency(ServiceInterfaceEntry sie, boolean mandatory) {
17         this.sie = sie;
18         this.mandatory = mandatory;
19     }
20
21     public ServiceInterfaceEntry getSie() {
22         return sie;
23     }
24
25     public boolean isMandatory() {
26         return mandatory;
27     }
28
29     @Override
30     public boolean equals(Object o) {
31         if (this == o) {
32             return true;
33         }
34         if (o == null || getClass() != o.getClass()) {
35             return false;
36         }
37
38         Dependency that = (Dependency) o;
39
40         if (mandatory != that.mandatory) {
41             return false;
42         }
43         if (!sie.equals(that.sie)) {
44             return false;
45         }
46
47         return true;
48     }
49
50     @Override
51     public int hashCode() {
52         int result = sie.hashCode();
53         result = 31 * result + (mandatory ? 1 : 0);
54         return result;
55     }
56 }