-/*\r
- * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.yangtools.yang.parser.builder.api;\r
-\r
-import java.util.List;\r
-\r
-import org.opendaylight.yangtools.yang.common.QName;\r
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;\r
-import org.opendaylight.yangtools.yang.model.api.Status;\r
-import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;\r
-\r
-/**\r
- * Basic implementation of SchemaNodeBuilder.\r
- */\r
-public abstract class AbstractSchemaNodeBuilder extends AbstractBuilder implements SchemaNodeBuilder {\r
- protected QName qname;\r
- protected SchemaPath schemaPath;\r
- protected String description;\r
- protected String reference;\r
- protected Status status = Status.CURRENT;\r
- protected List<UnknownSchemaNode> unknownNodes;\r
-\r
- protected AbstractSchemaNodeBuilder(final String moduleName, final int line, final QName qname) {\r
- super(moduleName, line);\r
- this.qname = qname;\r
- }\r
-\r
- public QName getQName() {\r
- return qname;\r
- }\r
-\r
- @Override\r
- public SchemaPath getPath() {\r
- return schemaPath;\r
- }\r
-\r
- @Override\r
- public void setPath(SchemaPath schemaPath) {\r
- this.schemaPath = schemaPath;\r
- }\r
-\r
- @Override\r
- public String getDescription() {\r
- return description;\r
- }\r
-\r
- @Override\r
- public void setDescription(String description) {\r
- this.description = description;\r
- }\r
-\r
- @Override\r
- public String getReference() {\r
- return reference;\r
- }\r
-\r
- @Override\r
- public void setReference(String reference) {\r
- this.reference = reference;\r
- }\r
-\r
- @Override\r
- public Status getStatus() {\r
- return status;\r
- }\r
-\r
- @Override\r
- public void setStatus(Status status) {\r
- if (status != null) {\r
- this.status = status;\r
- }\r
- }\r
-\r
- public void setUnknownNodes(List<UnknownSchemaNode> unknownNodes) {\r
- this.unknownNodes = unknownNodes;\r
- }\r
-\r
-}\r
+/*
+ * 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.api;
+
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.model.api.SchemaPath;
+import org.opendaylight.yangtools.yang.model.api.Status;
+
+import com.google.common.base.Preconditions;
+
+/**
+ * Basic implementation of SchemaNodeBuilder.
+ */
+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(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 + ((parentBuilder == null) ? 0 : parentBuilder.hashCode());
+ result = prime * result + ((schemaPath == null) ? 0 : schemaPath.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(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 (parentBuilder == null) {
+ if (other.parentBuilder != null) {
+ return false;
+ }
+ } else if (!parentBuilder.equals(other.parentBuilder)) {
+ return false;
+ }
+ if (schemaPath == null) {
+ if (other.schemaPath != null) {
+ return false;
+ }
+ } else if (!schemaPath.equals(other.schemaPath)) {
+ return false;
+ }
+ return true;
+ }
+
+}