Remove 'model' from package names in yang-model-parser-impl.
[controller.git] / opendaylight / sal / yang-prototype / code-generator / yang-model-parser-impl / src / main / java / org / opendaylight / controller / yang / parser / util / MustDefinitionImpl.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.yang.parser.util;
9
10 import org.opendaylight.controller.yang.model.api.MustDefinition;
11 import org.opendaylight.controller.yang.model.api.RevisionAwareXPath;
12
13 public final class MustDefinitionImpl implements MustDefinition {
14     private final String mustStr;
15     private final String description;
16     private final String reference;
17     private final String errorAppTag;
18     private final String errorMessage;
19
20     public MustDefinitionImpl(String mustStr, String description,
21             String reference, String errorAppTag, String errorMessage) {
22         this.mustStr = mustStr;
23         this.description = description;
24         this.reference = reference;
25         this.errorAppTag = errorAppTag;
26         this.errorMessage = errorMessage;
27     }
28
29     @Override
30     public String getDescription() {
31         return description;
32     }
33
34     @Override
35     public String getErrorAppTag() {
36         return errorAppTag;
37     }
38
39     @Override
40     public String getErrorMessage() {
41         return errorMessage;
42     }
43
44     @Override
45     public String getReference() {
46         return reference;
47     }
48
49     @Override
50     public RevisionAwareXPath getXpath() {
51         return null;
52     }
53
54     @Override
55     public int hashCode() {
56         final int prime = 31;
57         int result = 1;
58         result = prime * result + ((mustStr == null) ? 0 : mustStr.hashCode());
59         result = prime * result
60                 + ((description == null) ? 0 : description.hashCode());
61         result = prime * result
62                 + ((reference == null) ? 0 : reference.hashCode());
63         return result;
64     }
65
66     @Override
67     public boolean equals(Object obj) {
68         if (this == obj) {
69             return true;
70         }
71         if (obj == null) {
72             return false;
73         }
74         if (getClass() != obj.getClass()) {
75             return false;
76         }
77         final MustDefinitionImpl other = (MustDefinitionImpl) obj;
78         if (mustStr == null) {
79             if (other.mustStr != null) {
80                 return false;
81             }
82         } else if (!mustStr.equals(other.mustStr)) {
83             return false;
84         }
85         if (description == null) {
86             if (other.description != null) {
87                 return false;
88             }
89         } else if (!description.equals(other.description)) {
90             return false;
91         }
92         if (reference == null) {
93             if (other.reference != null) {
94                 return false;
95             }
96         } else if (!reference.equals(other.reference)) {
97             return false;
98         }
99         return true;
100     }
101
102     @Override
103     public String toString() {
104         return mustStr;
105     }
106
107 }