Merge "Fix checkstyle warnings in opendaylight/config"
[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         if (o == null || getClass() != o.getClass())
34             return false;
35
36         Dependency that = (Dependency) o;
37
38         if (mandatory != that.mandatory)
39             return false;
40         if (!sie.equals(that.sie))
41             return false;
42
43         return true;
44     }
45
46     @Override
47     public int hashCode() {
48         int result = sie.hashCode();
49         result = 31 * result + (mandatory ? 1 : 0);
50         return result;
51     }
52 }