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.base.Optional;
11 import com.google.common.collect.ImmutableList;
12 import java.util.List;
13 import java.util.Objects;
14 import org.opendaylight.yangtools.yang.common.QName;
15 import org.opendaylight.yangtools.yang.model.api.AnyXmlSchemaNode;
16 import org.opendaylight.yangtools.yang.model.api.ConstraintDefinition;
17 import org.opendaylight.yangtools.yang.model.api.DerivableSchemaNode;
18 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
19 import org.opendaylight.yangtools.yang.model.api.Status;
20 import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
22 final class AnyXmlSchemaNodeImpl implements AnyXmlSchemaNode, DerivableSchemaNode {
23 private final QName qname;
24 private final SchemaPath path;
28 boolean configuration;
29 AnyXmlSchemaNode original;
30 ConstraintDefinition constraintsDef;
33 ImmutableList<UnknownSchemaNode> unknownNodes;
35 AnyXmlSchemaNodeImpl(final QName qname, final SchemaPath path) {
41 public QName getQName() {
46 public SchemaPath getPath() {
51 public String getDescription() {
56 public String getReference() {
61 public Status getStatus() {
66 public boolean isAugmenting() {
71 public boolean isAddedByUses() {
76 public Optional<AnyXmlSchemaNode> getOriginal() {
77 return Optional.fromNullable(original);
81 public boolean isConfiguration() {
86 public ConstraintDefinition getConstraints() {
87 return constraintsDef;
91 public List<UnknownSchemaNode> getUnknownSchemaNodes() {
96 public int hashCode() {
99 result = prime * result + Objects.hashCode(qname);
100 result = prime * result + Objects.hashCode(path);
105 public boolean equals(final Object obj) {
112 if (getClass() != obj.getClass()) {
115 AnyXmlSchemaNodeImpl other = (AnyXmlSchemaNodeImpl) obj;
117 if (other.qname != null) {
120 } else if (!qname.equals(other.qname)) {
124 if (other.path != null) {
127 } else if (!path.equals(other.path)) {
134 public String toString() {
135 StringBuilder sb = new StringBuilder(AnyXmlSchemaNodeImpl.class.getSimpleName());
137 sb.append("qname=").append(qname);
138 sb.append(", path=").append(path);
140 return sb.toString();