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
27 protected AbstractSchemaNodeBuilder(final String moduleName, final int line, final QName qname) {
\r
28 super(moduleName, line);
\r
33 public int hashCode() {
\r
34 final int prime = 31;
\r
35 int result = super.hashCode();
\r
36 result = prime * result + ((parentBuilder == null) ? 0 : parentBuilder.hashCode());
\r
37 result = prime * result + ((schemaPath == null) ? 0 : schemaPath.hashCode());
\r
42 public boolean equals(Object obj) {
\r
49 if (getClass() != obj.getClass()) {
\r
52 if (!super.equals(obj)) {
\r
55 AbstractSchemaNodeBuilder other = (AbstractSchemaNodeBuilder) obj;
\r
56 if (parentBuilder == null) {
\r
57 if (other.parentBuilder != null) {
\r
60 } else if (!parentBuilder.equals(other.parentBuilder)) {
\r
63 if (schemaPath == null) {
\r
64 if (other.schemaPath != null) {
\r
67 } else if (!schemaPath.equals(other.schemaPath)) {
\r
73 public QName getQName() {
\r
78 public SchemaPath getPath() {
\r
83 public void setPath(SchemaPath schemaPath) {
\r
84 this.schemaPath = schemaPath;
\r
88 public String getDescription() {
\r
93 public void setDescription(String description) {
\r
94 this.description = description;
\r
98 public String getReference() {
\r
103 public void setReference(String reference) {
\r
104 this.reference = reference;
\r
108 public Status getStatus() {
\r
113 public void setStatus(Status status) {
\r
114 if (status != null) {
\r
115 this.status = status;
\r
119 public void setUnknownNodes(List<UnknownSchemaNode> unknownNodes) {
\r
120 this.unknownNodes = unknownNodes;
\r