BUG-865: deprecate pre-Beryllium parser elements
[yangtools.git] / yang / yang-parser-impl / src / main / java / org / opendaylight / yangtools / yang / parser / builder / impl / RefineHolderImpl.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.yangtools.yang.parser.builder.impl;
9
10 import java.util.Objects;
11 import org.opendaylight.yangtools.yang.model.api.MustDefinition;
12 import org.opendaylight.yangtools.yang.model.api.Status;
13 import org.opendaylight.yangtools.yang.parser.builder.api.RefineBuilder;
14 import org.opendaylight.yangtools.yang.parser.builder.util.AbstractBuilder;
15
16 /**
17  * @deprecated Pre-Beryllium implementation, scheduled for removal.
18  */
19 @Deprecated
20 public final class RefineHolderImpl extends AbstractBuilder implements RefineBuilder {
21     private final String targetPathString;
22     private String defaultStr;
23     private String description;
24     private String reference;
25     private Boolean config;
26     private Boolean mandatory;
27     private Boolean presence;
28     private MustDefinition must;
29     private Integer minElements;
30     private Integer maxElements;
31
32     public RefineHolderImpl(final String moduleName, final int line, final String name) {
33         super(moduleName, line);
34         this.targetPathString = name;
35     }
36
37     @Override
38     public String getDefaultStr() {
39         return defaultStr;
40     }
41
42     public void setDefaultStr(final String defaultStr) {
43         this.defaultStr = defaultStr;
44     }
45
46     /* (non-Javadoc)
47      * @see org.opendaylight.yangtools.yang.parser.builder.impl.IRefineBuilder#getDescription()
48      */
49     @Override
50     public String getDescription() {
51         return description;
52     }
53
54     /* (non-Javadoc)
55      * @see org.opendaylight.yangtools.yang.parser.builder.impl.IRefineBuilder#setDescription(java.lang.String)
56      */
57     @Override
58     public void setDescription(final String description) {
59         this.description = description;
60     }
61
62     /* (non-Javadoc)
63      * @see org.opendaylight.yangtools.yang.parser.builder.impl.IRefineBuilder#getReference()
64      */
65     @Override
66     public String getReference() {
67         return reference;
68     }
69
70     /* (non-Javadoc)
71      * @see org.opendaylight.yangtools.yang.parser.builder.impl.IRefineBuilder#setReference(java.lang.String)
72      */
73     @Override
74     public void setReference(final String reference) {
75         this.reference = reference;
76     }
77
78     /* (non-Javadoc)
79      * @see org.opendaylight.yangtools.yang.parser.builder.impl.IRefineBuilder#isConfiguration()
80      */
81     @Override
82     public Boolean isConfiguration() {
83         return config;
84     }
85
86     /* (non-Javadoc)
87      * @see org.opendaylight.yangtools.yang.parser.builder.impl.IRefineBuilder#setConfiguration(java.lang.Boolean)
88      */
89     @Override
90     public void setConfiguration(final Boolean config) {
91         this.config = config;
92     }
93
94     /* (non-Javadoc)
95      * @see org.opendaylight.yangtools.yang.parser.builder.impl.IRefineBuilder#isMandatory()
96      */
97     @Override
98     public Boolean isMandatory() {
99         return mandatory;
100     }
101
102     /* (non-Javadoc)
103      * @see org.opendaylight.yangtools.yang.parser.builder.impl.IRefineBuilder#setMandatory(java.lang.Boolean)
104      */
105     @Override
106     public void setMandatory(final Boolean mandatory) {
107         this.mandatory = mandatory;
108     }
109
110     /* (non-Javadoc)
111      * @see org.opendaylight.yangtools.yang.parser.builder.impl.IRefineBuilder#isPresence()
112      */
113     @Override
114     public Boolean isPresence() {
115         return presence;
116     }
117
118     /* (non-Javadoc)
119      * @see org.opendaylight.yangtools.yang.parser.builder.impl.IRefineBuilder#setPresence(java.lang.Boolean)
120      */
121     @Override
122     public void setPresence(final Boolean presence) {
123         this.presence = presence;
124     }
125
126     /* (non-Javadoc)
127      * @see org.opendaylight.yangtools.yang.parser.builder.impl.IRefineBuilder#getMust()
128      */
129     @Override
130     public MustDefinition getMust() {
131         return must;
132     }
133
134     /* (non-Javadoc)
135      * @see org.opendaylight.yangtools.yang.parser.builder.impl.IRefineBuilder#setMust(org.opendaylight.yangtools.yang.model.api.MustDefinition)
136      */
137     @Override
138     public void setMust(final MustDefinition must) {
139         this.must = must;
140     }
141
142     /* (non-Javadoc)
143      * @see org.opendaylight.yangtools.yang.parser.builder.impl.IRefineBuilder#getMinElements()
144      */
145     @Override
146     public Integer getMinElements() {
147         return minElements;
148     }
149
150     /* (non-Javadoc)
151      * @see org.opendaylight.yangtools.yang.parser.builder.impl.IRefineBuilder#setMinElements(java.lang.Integer)
152      */
153     @Override
154     public void setMinElements(final Integer minElements) {
155         this.minElements = minElements;
156     }
157
158     /* (non-Javadoc)
159      * @see org.opendaylight.yangtools.yang.parser.builder.impl.IRefineBuilder#getMaxElements()
160      */
161     @Override
162     public Integer getMaxElements() {
163         return maxElements;
164     }
165
166     /* (non-Javadoc)
167      * @see org.opendaylight.yangtools.yang.parser.builder.impl.IRefineBuilder#setMaxElements(java.lang.Integer)
168      */
169     @Override
170     public void setMaxElements(final Integer maxElements) {
171         this.maxElements = maxElements;
172     }
173
174     @Override
175     public String toString() {
176         return "refine " + targetPathString;
177     }
178
179     @Override
180     public Status getStatus() {
181         // TODO Auto-generated method stub
182         return null;
183     }
184
185     @Override
186     public void setStatus(final Status status) {
187         // TODO Auto-generated method stub
188
189     }
190
191     @Override
192     public int hashCode() {
193         final int prime = 31;
194         int result = 1;
195         result = prime * result + Objects.hashCode(addedUnknownNodes);
196         result = prime * result + Objects.hashCode(config);
197         result = prime * result + Objects.hashCode(defaultStr);
198         result = prime * result + Objects.hashCode(description);
199         result = prime * result + Objects.hashCode(mandatory);
200         result = prime * result + Objects.hashCode(maxElements);
201         result = prime * result + Objects.hashCode(minElements);
202         result = prime * result + Objects.hashCode(must);
203         result = prime * result + Objects.hashCode(targetPathString);
204         result = prime * result + Objects.hashCode(getParent());
205         result = prime * result + Objects.hashCode(presence);
206         result = prime * result + Objects.hashCode(reference);
207         return result;
208     }
209
210     @Override
211     public boolean equals(final Object obj) {
212         if (this == obj) {
213             return true;
214         }
215         if (obj == null) {
216             return false;
217         }
218         if (getClass() != obj.getClass()) {
219             return false;
220         }
221         RefineHolderImpl other = (RefineHolderImpl) obj;
222         if (addedUnknownNodes == null) {
223             if (other.addedUnknownNodes != null) {
224                 return false;
225             }
226         } else if (!addedUnknownNodes.equals(other.addedUnknownNodes)) {
227             return false;
228         }
229         if (config == null) {
230             if (other.config != null) {
231                 return false;
232             }
233         } else if (!config.equals(other.config)) {
234             return false;
235         }
236         if (defaultStr == null) {
237             if (other.defaultStr != null) {
238                 return false;
239             }
240         } else if (!defaultStr.equals(other.defaultStr)) {
241             return false;
242         }
243         if (description == null) {
244             if (other.description != null) {
245                 return false;
246             }
247         } else if (!description.equals(other.description)) {
248             return false;
249         }
250         if (mandatory == null) {
251             if (other.mandatory != null) {
252                 return false;
253             }
254         } else if (!mandatory.equals(other.mandatory)) {
255             return false;
256         }
257         if (maxElements == null) {
258             if (other.maxElements != null) {
259                 return false;
260             }
261         } else if (!maxElements.equals(other.maxElements)) {
262             return false;
263         }
264         if (minElements == null) {
265             if (other.minElements != null) {
266                 return false;
267             }
268         } else if (!minElements.equals(other.minElements)) {
269             return false;
270         }
271         if (must == null) {
272             if (other.must != null) {
273                 return false;
274             }
275         } else if (!must.equals(other.must)) {
276             return false;
277         }
278         if (targetPathString == null) {
279             if (other.targetPathString != null) {
280                 return false;
281             }
282         } else if (!targetPathString.equals(other.targetPathString)) {
283             return false;
284         }
285         if (getParent() == null) {
286             if (other.getParent() != null) {
287                 return false;
288             }
289         } else if (!getParent().equals(other.getParent())) {
290             return false;
291         }
292         if (presence == null) {
293             if (other.presence != null) {
294                 return false;
295             }
296         } else if (!presence.equals(other.presence)) {
297             return false;
298         }
299         if (reference == null) {
300             if (other.reference != null) {
301                 return false;
302             }
303         } else if (!reference.equals(other.reference)) {
304             return false;
305         }
306         return true;
307     }
308
309
310
311     @Override
312     public Object build() {
313         // FIXME: Currently RefineBuilder.build() is not used
314         // build should returned refined element, so
315         // whole refine process is encapsulated in this refinement
316         // statement.
317         return null;
318     }
319
320     @Override
321     public String getTargetPathString() {
322         return targetPathString;
323     }
324
325 }