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 org.opendaylight.yangtools.yang.common.QName;
14 import org.opendaylight.yangtools.yang.model.api.AnyXmlSchemaNode;
15 import org.opendaylight.yangtools.yang.model.api.ConstraintDefinition;
16 import org.opendaylight.yangtools.yang.model.api.DerivableSchemaNode;
17 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
18 import org.opendaylight.yangtools.yang.model.api.Status;
19 import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
21 final class AnyXmlSchemaNodeImpl implements AnyXmlSchemaNode, DerivableSchemaNode {
22 private final QName qname;
23 private final SchemaPath path;
27 boolean configuration;
28 AnyXmlSchemaNode original;
29 ConstraintDefinition constraintsDef;
32 ImmutableList<UnknownSchemaNode> unknownNodes;
34 AnyXmlSchemaNodeImpl(final QName qname, final SchemaPath path) {
40 public QName getQName() {
45 public SchemaPath getPath() {
50 public String getDescription() {
55 public String getReference() {
60 public Status getStatus() {
65 public boolean isAugmenting() {
70 public boolean isAddedByUses() {
75 public Optional<AnyXmlSchemaNode> getOriginal() {
76 return Optional.fromNullable(original);
80 public boolean isConfiguration() {
85 public ConstraintDefinition getConstraints() {
86 return constraintsDef;
90 public List<UnknownSchemaNode> getUnknownSchemaNodes() {
95 public int hashCode() {
98 result = prime * result + ((qname == null) ? 0 : qname.hashCode());
99 result = prime * result + ((path == null) ? 0 : path.hashCode());
104 public boolean equals(final Object obj) {
111 if (getClass() != obj.getClass()) {
114 AnyXmlSchemaNodeImpl other = (AnyXmlSchemaNodeImpl) obj;
116 if (other.qname != null) {
119 } else if (!qname.equals(other.qname)) {
123 if (other.path != null) {
126 } else if (!path.equals(other.path)) {
133 public String toString() {
134 StringBuilder sb = new StringBuilder(AnyXmlSchemaNodeImpl.class.getSimpleName());
136 sb.append("qname=").append(qname);
137 sb.append(", path=").append(path);
139 return sb.toString();