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.ConstraintDefinition;
16 import org.opendaylight.yangtools.yang.model.api.DerivableSchemaNode;
17 import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
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.TypeDefinition;
21 import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
23 final class LeafListSchemaNodeImpl implements LeafListSchemaNode, DerivableSchemaNode {
24 private final QName qname;
25 private final SchemaPath path;
31 LeafListSchemaNode original;
32 boolean configuration;
33 ConstraintDefinition constraintsDef;
34 TypeDefinition<?> type;
36 ImmutableList<UnknownSchemaNode> unknownNodes;
38 LeafListSchemaNodeImpl(final QName qname, final SchemaPath path) {
44 public QName getQName() {
49 public SchemaPath getPath() {
54 public String getDescription() {
59 public String getReference() {
64 public Status getStatus() {
69 public boolean isAugmenting() {
74 public boolean isAddedByUses() {
79 public Optional<LeafListSchemaNode> getOriginal() {
80 return Optional.fromNullable(original);
84 public boolean isConfiguration() {
89 public ConstraintDefinition getConstraints() {
90 return constraintsDef;
94 public TypeDefinition<?> getType() {
99 public boolean isUserOrdered() {
104 public List<UnknownSchemaNode> getUnknownSchemaNodes() {
109 public int hashCode() {
110 final int prime = 31;
112 result = prime * result + Objects.hashCode(qname);
113 result = prime * result + Objects.hashCode(path);
118 public boolean equals(final Object obj) {
125 if (getClass() != obj.getClass()) {
128 LeafListSchemaNodeImpl other = (LeafListSchemaNodeImpl) obj;
130 if (other.qname != null) {
133 } else if (!qname.equals(other.qname)) {
137 if (other.path != null) {
140 } else if (!path.equals(other.path)) {
147 public String toString() {
148 StringBuilder sb = new StringBuilder(LeafListSchemaNodeImpl.class.getSimpleName());
152 return sb.toString();