Added more descriptive parsing exceptions.
[controller.git] / opendaylight / sal / yang-prototype / code-generator / yang-model-parser-impl / src / main / java / org / opendaylight / controller / yang / parser / util / RefineHolder.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.parser.builder.api.AbstractBuilder;
12
13 public final class RefineHolder extends AbstractBuilder {
14     private final String name;
15     private String defaultStr;
16     private String description;
17     private String reference;
18     private Boolean config;
19     private Boolean mandatory;
20     private Boolean presence;
21     private MustDefinition must;
22     private Integer minElements;
23     private Integer maxElements;
24
25     public RefineHolder(final String moduleName, final int line, final String name) {
26         super(moduleName, line);
27         this.name = name;
28     }
29
30     public String getDefaultStr() {
31         return defaultStr;
32     }
33
34     public void setDefaultStr(final String defaultStr) {
35         this.defaultStr = defaultStr;
36     }
37
38     public String getDescription() {
39         return description;
40     }
41
42     public void setDescription(final String description) {
43         this.description = description;
44     }
45
46     public String getReference() {
47         return reference;
48     }
49
50     public void setReference(final String reference) {
51         this.reference = reference;
52     }
53
54     public Boolean isConfiguration() {
55         return config;
56     }
57
58     public void setConfiguration(final Boolean config) {
59         this.config = config;
60     }
61
62     public Boolean isMandatory() {
63         return mandatory;
64     }
65
66     public void setMandatory(Boolean mandatory) {
67         this.mandatory = mandatory;
68     }
69
70     public Boolean isPresence() {
71         return presence;
72     }
73
74     public void setPresence(Boolean presence) {
75         this.presence = presence;
76     }
77
78     public MustDefinition getMust() {
79         return must;
80     }
81
82     public void setMust(MustDefinition must) {
83         this.must = must;
84     }
85
86     public Integer getMinElements() {
87         return minElements;
88     }
89
90     public void setMinElements(Integer minElements) {
91         this.minElements = minElements;
92     }
93
94     public Integer getMaxElements() {
95         return maxElements;
96     }
97
98     public void setMaxElements(Integer maxElements) {
99         this.maxElements = maxElements;
100     }
101
102     public String getName() {
103         return name;
104     }
105
106     @Override
107     public Object build() {
108         return null;
109     }
110
111     @Override
112     public int hashCode() {
113         final int prime = 31;
114         int result = 1;
115         result = prime * result + ((addedUnknownNodes == null) ? 0 : addedUnknownNodes.hashCode());
116         result = prime * result + ((config == null) ? 0 : config.hashCode());
117         result = prime * result + ((defaultStr == null) ? 0 : defaultStr.hashCode());
118         result = prime * result + ((description == null) ? 0 : description.hashCode());
119         result = prime * result + ((mandatory == null) ? 0 : mandatory.hashCode());
120         result = prime * result + ((maxElements == null) ? 0 : maxElements.hashCode());
121         result = prime * result + ((minElements == null) ? 0 : minElements.hashCode());
122         result = prime * result + ((must == null) ? 0 : must.hashCode());
123         result = prime * result + ((name == null) ? 0 : name.hashCode());
124         result = prime * result + ((parent == null) ? 0 : parent.hashCode());
125         result = prime * result + ((presence == null) ? 0 : presence.hashCode());
126         result = prime * result + ((reference == null) ? 0 : reference.hashCode());
127         return result;
128     }
129
130     @Override
131     public boolean equals(Object obj) {
132         if (this == obj)
133             return true;
134         if (obj == null)
135             return false;
136         if (getClass() != obj.getClass())
137             return false;
138         RefineHolder other = (RefineHolder) obj;
139         if (addedUnknownNodes == null) {
140             if (other.addedUnknownNodes != null)
141                 return false;
142         } else if (!addedUnknownNodes.equals(other.addedUnknownNodes))
143             return false;
144         if (config == null) {
145             if (other.config != null)
146                 return false;
147         } else if (!config.equals(other.config))
148             return false;
149         if (defaultStr == null) {
150             if (other.defaultStr != null)
151                 return false;
152         } else if (!defaultStr.equals(other.defaultStr))
153             return false;
154         if (description == null) {
155             if (other.description != null)
156                 return false;
157         } else if (!description.equals(other.description))
158             return false;
159         if (mandatory == null) {
160             if (other.mandatory != null)
161                 return false;
162         } else if (!mandatory.equals(other.mandatory))
163             return false;
164         if (maxElements == null) {
165             if (other.maxElements != null)
166                 return false;
167         } else if (!maxElements.equals(other.maxElements))
168             return false;
169         if (minElements == null) {
170             if (other.minElements != null)
171                 return false;
172         } else if (!minElements.equals(other.minElements))
173             return false;
174         if (must == null) {
175             if (other.must != null)
176                 return false;
177         } else if (!must.equals(other.must))
178             return false;
179         if (name == null) {
180             if (other.name != null)
181                 return false;
182         } else if (!name.equals(other.name))
183             return false;
184         if (parent == null) {
185             if (other.parent != null)
186                 return false;
187         } else if (!parent.equals(other.parent))
188             return false;
189         if (presence == null) {
190             if (other.presence != null)
191                 return false;
192         } else if (!presence.equals(other.presence))
193             return false;
194         if (reference == null) {
195             if (other.reference != null)
196                 return false;
197         } else if (!reference.equals(other.reference))
198             return false;
199         return true;
200     }
201
202     @Override
203     public String toString() {
204         return "refine " + name;
205     }
206
207 }