2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
\r
4 * This program and the accompanying materials are made available under the
\r
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
\r
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
\r
8 package org.opendaylight.yangtools.yang.parser.builder.api;
\r
10 import java.util.List;
\r
12 import org.opendaylight.yangtools.yang.common.QName;
\r
13 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
\r
14 import org.opendaylight.yangtools.yang.model.api.Status;
\r
15 import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
\r
18 * Basic implementation of SchemaNodeBuilder.
\r
20 public abstract class AbstractSchemaNodeBuilder extends AbstractBuilder implements SchemaNodeBuilder {
\r
21 protected QName qname;
\r
22 protected SchemaPath schemaPath;
\r
23 protected String description;
\r
24 protected String reference;
\r
25 protected Status status = Status.CURRENT;
\r
26 protected List<UnknownSchemaNode> unknownNodes;
\r
28 protected AbstractSchemaNodeBuilder(final String moduleName, final int line, final QName qname) {
\r
29 super(moduleName, line);
\r
34 public int hashCode() {
\r
35 final int prime = 31;
\r
36 int result = super.hashCode();
\r
37 result = prime * result + ((parent == null) ? 0 : parent.hashCode());
\r
38 result = prime * result + ((schemaPath == null) ? 0 : schemaPath.hashCode());
\r
43 public boolean equals(Object obj) {
\r
50 if (getClass() != obj.getClass()) {
\r
53 if (!super.equals(obj)) {
\r
56 AbstractSchemaNodeBuilder other = (AbstractSchemaNodeBuilder) obj;
\r
57 if (parent == null) {
\r
58 if (other.parent != null) {
\r
61 } else if (!parent.equals(other.parent)) {
\r
64 if (schemaPath == null) {
\r
65 if (other.schemaPath != null) {
\r
68 } else if (!schemaPath.equals(other.schemaPath)) {
\r
74 public QName getQName() {
\r
79 public SchemaPath getPath() {
\r
84 public void setPath(SchemaPath schemaPath) {
\r
85 this.schemaPath = schemaPath;
\r
89 public String getDescription() {
\r
94 public void setDescription(String description) {
\r
95 this.description = description;
\r
99 public String getReference() {
\r
104 public void setReference(String reference) {
\r
105 this.reference = reference;
\r
109 public Status getStatus() {
\r
114 public void setStatus(Status status) {
\r
115 if (status != null) {
\r
116 this.status = status;
\r
120 public void setUnknownNodes(List<UnknownSchemaNode> unknownNodes) {
\r
121 this.unknownNodes = unknownNodes;
\r