2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.yangtools.yang.parser.builder.impl;
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;
17 * @deprecated Pre-Beryllium implementation, scheduled for removal.
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;
32 public RefineHolderImpl(final String moduleName, final int line, final String name) {
33 super(moduleName, line);
34 this.targetPathString = name;
38 public String getDefaultStr() {
42 public void setDefaultStr(final String defaultStr) {
43 this.defaultStr = defaultStr;
47 * @see org.opendaylight.yangtools.yang.parser.builder.impl.IRefineBuilder#getDescription()
50 public String getDescription() {
55 * @see org.opendaylight.yangtools.yang.parser.builder.impl.IRefineBuilder#setDescription(java.lang.String)
58 public void setDescription(final String description) {
59 this.description = description;
63 * @see org.opendaylight.yangtools.yang.parser.builder.impl.IRefineBuilder#getReference()
66 public String getReference() {
71 * @see org.opendaylight.yangtools.yang.parser.builder.impl.IRefineBuilder#setReference(java.lang.String)
74 public void setReference(final String reference) {
75 this.reference = reference;
79 * @see org.opendaylight.yangtools.yang.parser.builder.impl.IRefineBuilder#isConfiguration()
82 public Boolean isConfiguration() {
87 * @see org.opendaylight.yangtools.yang.parser.builder.impl.IRefineBuilder#setConfiguration(java.lang.Boolean)
90 public void setConfiguration(final Boolean config) {
95 * @see org.opendaylight.yangtools.yang.parser.builder.impl.IRefineBuilder#isMandatory()
98 public Boolean isMandatory() {
103 * @see org.opendaylight.yangtools.yang.parser.builder.impl.IRefineBuilder#setMandatory(java.lang.Boolean)
106 public void setMandatory(final Boolean mandatory) {
107 this.mandatory = mandatory;
111 * @see org.opendaylight.yangtools.yang.parser.builder.impl.IRefineBuilder#isPresence()
114 public Boolean isPresence() {
119 * @see org.opendaylight.yangtools.yang.parser.builder.impl.IRefineBuilder#setPresence(java.lang.Boolean)
122 public void setPresence(final Boolean presence) {
123 this.presence = presence;
127 * @see org.opendaylight.yangtools.yang.parser.builder.impl.IRefineBuilder#getMust()
130 public MustDefinition getMust() {
135 * @see org.opendaylight.yangtools.yang.parser.builder.impl.IRefineBuilder#setMust(org.opendaylight.yangtools.yang.model.api.MustDefinition)
138 public void setMust(final MustDefinition must) {
143 * @see org.opendaylight.yangtools.yang.parser.builder.impl.IRefineBuilder#getMinElements()
146 public Integer getMinElements() {
151 * @see org.opendaylight.yangtools.yang.parser.builder.impl.IRefineBuilder#setMinElements(java.lang.Integer)
154 public void setMinElements(final Integer minElements) {
155 this.minElements = minElements;
159 * @see org.opendaylight.yangtools.yang.parser.builder.impl.IRefineBuilder#getMaxElements()
162 public Integer getMaxElements() {
167 * @see org.opendaylight.yangtools.yang.parser.builder.impl.IRefineBuilder#setMaxElements(java.lang.Integer)
170 public void setMaxElements(final Integer maxElements) {
171 this.maxElements = maxElements;
175 public String toString() {
176 return "refine " + targetPathString;
180 public Status getStatus() {
181 // TODO Auto-generated method stub
186 public void setStatus(final Status status) {
187 // TODO Auto-generated method stub
192 public int hashCode() {
193 final int prime = 31;
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);
211 public boolean equals(final Object obj) {
218 if (getClass() != obj.getClass()) {
221 RefineHolderImpl other = (RefineHolderImpl) obj;
222 if (addedUnknownNodes == null) {
223 if (other.addedUnknownNodes != null) {
226 } else if (!addedUnknownNodes.equals(other.addedUnknownNodes)) {
229 if (config == null) {
230 if (other.config != null) {
233 } else if (!config.equals(other.config)) {
236 if (defaultStr == null) {
237 if (other.defaultStr != null) {
240 } else if (!defaultStr.equals(other.defaultStr)) {
243 if (description == null) {
244 if (other.description != null) {
247 } else if (!description.equals(other.description)) {
250 if (mandatory == null) {
251 if (other.mandatory != null) {
254 } else if (!mandatory.equals(other.mandatory)) {
257 if (maxElements == null) {
258 if (other.maxElements != null) {
261 } else if (!maxElements.equals(other.maxElements)) {
264 if (minElements == null) {
265 if (other.minElements != null) {
268 } else if (!minElements.equals(other.minElements)) {
272 if (other.must != null) {
275 } else if (!must.equals(other.must)) {
278 if (targetPathString == null) {
279 if (other.targetPathString != null) {
282 } else if (!targetPathString.equals(other.targetPathString)) {
285 if (getParent() == null) {
286 if (other.getParent() != null) {
289 } else if (!getParent().equals(other.getParent())) {
292 if (presence == null) {
293 if (other.presence != null) {
296 } else if (!presence.equals(other.presence)) {
299 if (reference == null) {
300 if (other.reference != null) {
303 } else if (!reference.equals(other.reference)) {
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
321 public String getTargetPathString() {
322 return targetPathString;