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.util;
10 import com.google.common.base.Preconditions;
11 import java.util.Objects;
12 import org.opendaylight.yangtools.yang.common.QName;
13 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
14 import org.opendaylight.yangtools.yang.model.api.Status;
15 import org.opendaylight.yangtools.yang.parser.builder.api.SchemaNodeBuilder;
18 * Basic implementation of SchemaNodeBuilder.
20 * @deprecated Pre-Beryllium implementation, scheduled for removal.
23 public abstract class AbstractSchemaNodeBuilder extends AbstractBuilder implements SchemaNodeBuilder {
24 protected final QName qname;
25 protected SchemaPath schemaPath;
26 protected String description;
27 protected String reference;
28 protected Status status = Status.CURRENT;
30 protected AbstractSchemaNodeBuilder(final String moduleName, final int line, final QName qname) {
31 super(moduleName, line);
36 public QName getQName() {
41 public SchemaPath getPath() {
46 public void setPath(final SchemaPath path) {
47 this.schemaPath = path;
51 public String getDescription() {
56 public void setDescription(final String description) {
57 this.description = description;
61 public String getReference() {
66 public void setReference(final String reference) {
67 this.reference = reference;
71 public Status getStatus() {
76 public void setStatus(final Status status) {
77 this.status = Preconditions.checkNotNull(status, "status cannot be null");
81 public int hashCode() {
83 int result = super.hashCode();
84 result = prime * result + Objects.hashCode(getParent());
85 result = prime * result + Objects.hashCode(schemaPath);
90 public boolean equals(final Object obj) {
97 if (getClass() != obj.getClass()) {
100 if (!super.equals(obj)) {
103 AbstractSchemaNodeBuilder other = (AbstractSchemaNodeBuilder) obj;
104 if (getParent() == null) {
105 if (other.getParent() != null) {
108 } else if (!getParent().equals(other.getParent())) {
111 if (schemaPath == null) {
112 if (other.schemaPath != null) {
115 } else if (!schemaPath.equals(other.schemaPath)) {