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.impl;
10 import com.google.common.collect.ImmutableList;
11 import java.util.List;
12 import java.util.Objects;
13 import org.opendaylight.yangtools.yang.common.QName;
14 import org.opendaylight.yangtools.yang.model.api.ExtensionDefinition;
15 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
16 import org.opendaylight.yangtools.yang.model.api.Status;
17 import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
19 final class UnknownSchemaNodeImpl implements UnknownSchemaNode {
20 private final QName qname;
21 private final SchemaPath path;
22 private ExtensionDefinition extension;
25 Status status = Status.CURRENT;
26 private List<UnknownSchemaNode> unknownNodes = ImmutableList.of();
27 private QName nodeType;
28 private String nodeParameter;
31 UnknownSchemaNodeImpl(final QName qname, final SchemaPath path) {
37 public QName getQName() {
42 public SchemaPath getPath() {
47 public ExtensionDefinition getExtensionDefinition() {
51 void setExtensionDefinition(final ExtensionDefinition extension) {
52 this.extension = extension;
56 public String getDescription() {
61 public String getReference() {
66 public Status getStatus() {
71 public boolean isAddedByUses() {
76 public List<UnknownSchemaNode> getUnknownSchemaNodes() {
80 void setUnknownSchemaNodes(final List<UnknownSchemaNode> unknownNodes) {
81 if (unknownNodes != null) {
82 this.unknownNodes = ImmutableList.copyOf(unknownNodes);
87 public QName getNodeType() {
91 void setNodeType(final QName nodeType) {
92 this.nodeType = nodeType;
96 public String getNodeParameter() {
100 void setNodeParameter(final String nodeParameter) {
101 this.nodeParameter = nodeParameter;
105 public String toString() {
106 StringBuilder sb = new StringBuilder();
107 sb.append(nodeType.getNamespace());
109 sb.append(nodeType.getLocalName());
111 sb.append(nodeParameter);
112 return sb.toString();
116 public int hashCode() {
117 final int prime = 31;
119 result = prime * result + Objects.hashCode(qname);
120 result = prime * result + Objects.hashCode(path);
121 result = prime * result + Objects.hashCode(nodeType);
122 result = prime * result + Objects.hashCode(nodeParameter);
127 public boolean equals(final Object obj) {
134 if (getClass() != obj.getClass()) {
137 UnknownSchemaNodeImpl other = (UnknownSchemaNodeImpl) obj;
139 if (other.qname != null) {
142 } else if (!qname.equals(other.qname)) {
146 if (other.path != null) {
149 } else if (!path.equals(other.path)) {
152 if (nodeType == null) {
153 if (other.nodeType != null) {
156 } else if (!nodeType.equals(other.nodeType)) {
159 if (nodeParameter == null) {
160 if (other.nodeParameter != null) {
163 } else if (!nodeParameter.equals(other.nodeParameter)) {
170 public boolean isAddedByAugmentation() {