/* * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ package org.opendaylight.yangtools.yang.parser.builder.util; import com.google.common.base.Preconditions; import java.util.Objects; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.model.api.SchemaPath; import org.opendaylight.yangtools.yang.model.api.Status; import org.opendaylight.yangtools.yang.parser.builder.api.SchemaNodeBuilder; /** * Basic implementation of SchemaNodeBuilder. * * @deprecated Pre-Beryllium implementation, scheduled for removal. */ @Deprecated public abstract class AbstractSchemaNodeBuilder extends AbstractBuilder implements SchemaNodeBuilder { protected final QName qname; protected SchemaPath schemaPath; protected String description; protected String reference; protected Status status = Status.CURRENT; protected AbstractSchemaNodeBuilder(final String moduleName, final int line, final QName qname) { super(moduleName, line); this.qname = qname; } @Override public QName getQName() { return qname; } @Override public SchemaPath getPath() { return schemaPath; } @Override public void setPath(final SchemaPath path) { this.schemaPath = path; } @Override public String getDescription() { return description; } @Override public void setDescription(final String description) { this.description = description; } @Override public String getReference() { return reference; } @Override public void setReference(final String reference) { this.reference = reference; } @Override public Status getStatus() { return status; } @Override public void setStatus(final Status status) { this.status = Preconditions.checkNotNull(status, "status cannot be null"); } @Override public int hashCode() { final int prime = 31; int result = super.hashCode(); result = prime * result + Objects.hashCode(getParent()); result = prime * result + Objects.hashCode(schemaPath); return result; } @Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } if (!super.equals(obj)) { return false; } AbstractSchemaNodeBuilder other = (AbstractSchemaNodeBuilder) obj; if (getParent() == null) { if (other.getParent() != null) { return false; } } else if (!getParent().equals(other.getParent())) { return false; } if (schemaPath == null) { if (other.schemaPath != null) { return false; } } else if (!schemaPath.equals(other.schemaPath)) { return false; } return true; } }