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.util;
10 import org.opendaylight.yangtools.yang.model.api.MustDefinition;
11 import org.opendaylight.yangtools.yang.parser.builder.api.AbstractBuilder;
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;
25 public RefineHolder(final String moduleName, final int line, final String name) {
26 super(moduleName, line);
30 public String getDefaultStr() {
34 public void setDefaultStr(final String defaultStr) {
35 this.defaultStr = defaultStr;
38 public String getDescription() {
42 public void setDescription(final String description) {
43 this.description = description;
46 public String getReference() {
50 public void setReference(final String reference) {
51 this.reference = reference;
54 public Boolean isConfiguration() {
58 public void setConfiguration(final Boolean config) {
62 public Boolean isMandatory() {
66 public void setMandatory(Boolean mandatory) {
67 this.mandatory = mandatory;
70 public Boolean isPresence() {
74 public void setPresence(Boolean presence) {
75 this.presence = presence;
78 public MustDefinition getMust() {
82 public void setMust(MustDefinition must) {
86 public Integer getMinElements() {
90 public void setMinElements(Integer minElements) {
91 this.minElements = minElements;
94 public Integer getMaxElements() {
98 public void setMaxElements(Integer maxElements) {
99 this.maxElements = maxElements;
102 public String getName() {
107 public Object build() {
112 public int hashCode() {
113 final int prime = 31;
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 + ((parentBuilder == null) ? 0 : parentBuilder.hashCode());
125 result = prime * result + ((presence == null) ? 0 : presence.hashCode());
126 result = prime * result + ((reference == null) ? 0 : reference.hashCode());
131 public boolean equals(Object obj) {
138 if (getClass() != obj.getClass()) {
141 RefineHolder other = (RefineHolder) obj;
142 if (addedUnknownNodes == null) {
143 if (other.addedUnknownNodes != null) {
146 } else if (!addedUnknownNodes.equals(other.addedUnknownNodes)) {
149 if (config == null) {
150 if (other.config != null) {
153 } else if (!config.equals(other.config)) {
156 if (defaultStr == null) {
157 if (other.defaultStr != null) {
160 } else if (!defaultStr.equals(other.defaultStr)) {
163 if (description == null) {
164 if (other.description != null) {
167 } else if (!description.equals(other.description)) {
170 if (mandatory == null) {
171 if (other.mandatory != null) {
174 } else if (!mandatory.equals(other.mandatory)) {
177 if (maxElements == null) {
178 if (other.maxElements != null) {
181 } else if (!maxElements.equals(other.maxElements)) {
184 if (minElements == null) {
185 if (other.minElements != null) {
188 } else if (!minElements.equals(other.minElements)) {
192 if (other.must != null) {
195 } else if (!must.equals(other.must)) {
199 if (other.name != null) {
202 } else if (!name.equals(other.name)) {
205 if (parentBuilder == null) {
206 if (other.parentBuilder != null) {
209 } else if (!parentBuilder.equals(other.parentBuilder)) {
212 if (presence == null) {
213 if (other.presence != null) {
216 } else if (!presence.equals(other.presence)) {
219 if (reference == null) {
220 if (other.reference != null) {
223 } else if (!reference.equals(other.reference)) {
230 public String toString() {
231 return "refine " + name;