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.model.api.YangNode;
12 import org.opendaylight.yangtools.yang.parser.builder.api.AbstractBuilder;
14 public final class RefineHolder extends AbstractBuilder {
15 private final String name;
16 private String defaultStr;
17 private String description;
18 private String reference;
19 private Boolean config;
20 private Boolean mandatory;
21 private Boolean presence;
22 private MustDefinition must;
23 private Integer minElements;
24 private Integer maxElements;
26 public RefineHolder(final String moduleName, final int line, final String name) {
27 super(moduleName, line);
31 public String getDefaultStr() {
35 public void setDefaultStr(final String defaultStr) {
36 this.defaultStr = defaultStr;
39 public String getDescription() {
43 public void setDescription(final String description) {
44 this.description = description;
47 public String getReference() {
51 public void setReference(final String reference) {
52 this.reference = reference;
55 public Boolean isConfiguration() {
59 public void setConfiguration(final Boolean config) {
63 public Boolean isMandatory() {
67 public void setMandatory(Boolean mandatory) {
68 this.mandatory = mandatory;
71 public Boolean isPresence() {
75 public void setPresence(Boolean presence) {
76 this.presence = presence;
79 public MustDefinition getMust() {
83 public void setMust(MustDefinition must) {
87 public Integer getMinElements() {
91 public void setMinElements(Integer minElements) {
92 this.minElements = minElements;
95 public Integer getMaxElements() {
99 public void setMaxElements(Integer maxElements) {
100 this.maxElements = maxElements;
103 public String getName() {
108 public Object build(YangNode parent) {
113 public int hashCode() {
114 final int prime = 31;
116 result = prime * result + ((addedUnknownNodes == null) ? 0 : addedUnknownNodes.hashCode());
117 result = prime * result + ((config == null) ? 0 : config.hashCode());
118 result = prime * result + ((defaultStr == null) ? 0 : defaultStr.hashCode());
119 result = prime * result + ((description == null) ? 0 : description.hashCode());
120 result = prime * result + ((mandatory == null) ? 0 : mandatory.hashCode());
121 result = prime * result + ((maxElements == null) ? 0 : maxElements.hashCode());
122 result = prime * result + ((minElements == null) ? 0 : minElements.hashCode());
123 result = prime * result + ((must == null) ? 0 : must.hashCode());
124 result = prime * result + ((name == null) ? 0 : name.hashCode());
125 result = prime * result + ((parentBuilder == null) ? 0 : parentBuilder.hashCode());
126 result = prime * result + ((presence == null) ? 0 : presence.hashCode());
127 result = prime * result + ((reference == null) ? 0 : reference.hashCode());
132 public boolean equals(Object obj) {
139 if (getClass() != obj.getClass()) {
142 RefineHolder other = (RefineHolder) obj;
143 if (addedUnknownNodes == null) {
144 if (other.addedUnknownNodes != null) {
147 } else if (!addedUnknownNodes.equals(other.addedUnknownNodes)) {
150 if (config == null) {
151 if (other.config != null) {
154 } else if (!config.equals(other.config)) {
157 if (defaultStr == null) {
158 if (other.defaultStr != null) {
161 } else if (!defaultStr.equals(other.defaultStr)) {
164 if (description == null) {
165 if (other.description != null) {
168 } else if (!description.equals(other.description)) {
171 if (mandatory == null) {
172 if (other.mandatory != null) {
175 } else if (!mandatory.equals(other.mandatory)) {
178 if (maxElements == null) {
179 if (other.maxElements != null) {
182 } else if (!maxElements.equals(other.maxElements)) {
185 if (minElements == null) {
186 if (other.minElements != null) {
189 } else if (!minElements.equals(other.minElements)) {
193 if (other.must != null) {
196 } else if (!must.equals(other.must)) {
200 if (other.name != null) {
203 } else if (!name.equals(other.name)) {
206 if (parentBuilder == null) {
207 if (other.parentBuilder != null) {
210 } else if (!parentBuilder.equals(other.parentBuilder)) {
213 if (presence == null) {
214 if (other.presence != null) {
217 } else if (!presence.equals(other.presence)) {
220 if (reference == null) {
221 if (other.reference != null) {
224 } else if (!reference.equals(other.reference)) {
231 public String toString() {
232 return "refine " + name;