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.ConstraintDefinition;
15 import org.opendaylight.yangtools.yang.model.api.DerivableSchemaNode;
16 import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
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.TypeDefinition;
20 import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
22 final class LeafListSchemaNodeImpl implements LeafListSchemaNode, DerivableSchemaNode {
23 private final QName qname;
24 private final SchemaPath path;
30 LeafListSchemaNode original;
31 boolean configuration;
32 ConstraintDefinition constraintsDef;
33 TypeDefinition<?> type;
35 ImmutableList<UnknownSchemaNode> unknownNodes;
37 LeafListSchemaNodeImpl(final QName qname, final SchemaPath path) {
43 public QName getQName() {
48 public SchemaPath getPath() {
53 public String getDescription() {
58 public String getReference() {
63 public Status getStatus() {
68 public boolean isAugmenting() {
73 public boolean isAddedByUses() {
78 public Optional<LeafListSchemaNode> getOriginal() {
79 return Optional.fromNullable(original);
83 public boolean isConfiguration() {
88 public ConstraintDefinition getConstraints() {
89 return constraintsDef;
93 public TypeDefinition<?> getType() {
98 public boolean isUserOrdered() {
103 public List<UnknownSchemaNode> getUnknownSchemaNodes() {
108 public int hashCode() {
109 final int prime = 31;
111 result = prime * result + ((qname == null) ? 0 : qname.hashCode());
112 result = prime * result + ((path == null) ? 0 : path.hashCode());
117 public boolean equals(final Object obj) {
124 if (getClass() != obj.getClass()) {
127 LeafListSchemaNodeImpl other = (LeafListSchemaNodeImpl) obj;
129 if (other.qname != null) {
132 } else if (!qname.equals(other.qname)) {
136 if (other.path != null) {
139 } else if (!path.equals(other.path)) {
146 public String toString() {
147 StringBuilder sb = new StringBuilder(LeafListSchemaNodeImpl.class.getSimpleName());
151 return sb.toString();