2 * Copyright (c) 2015 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
9 package org.opendaylight.yangtools.yang.parser.builder.impl;
11 import com.google.common.base.Optional;
12 import com.google.common.collect.ImmutableList;
13 import com.google.common.collect.ImmutableSet;
14 import java.util.List;
15 import java.util.Objects;
17 import org.opendaylight.yangtools.yang.common.QName;
18 import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
19 import org.opendaylight.yangtools.yang.model.api.ConstraintDefinition;
20 import org.opendaylight.yangtools.yang.model.api.DerivableSchemaNode;
21 import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
22 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
23 import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
24 import org.opendaylight.yangtools.yang.parser.builder.util.AbstractDocumentedDataNodeContainer;
26 final class ListSchemaNodeImpl extends AbstractDocumentedDataNodeContainer implements
27 ListSchemaNode, DerivableSchemaNode {
28 private final QName qname;
29 private final SchemaPath path;
30 ImmutableList<QName> keyDefinition;
33 ListSchemaNode original;
34 boolean configuration;
35 ConstraintDefinition constraints;
36 ImmutableSet<AugmentationSchema> augmentations;
37 ImmutableList<UnknownSchemaNode> unknownNodes;
40 ListSchemaNodeImpl(final QName qname, final SchemaPath path, final ListSchemaNodeBuilder builder) {
47 public QName getQName() {
52 public SchemaPath getPath() {
57 public List<QName> getKeyDefinition() {
62 public boolean isAugmenting() {
67 public boolean isAddedByUses() {
72 public Optional<ListSchemaNode> getOriginal() {
73 return Optional.fromNullable(original);
77 public boolean isConfiguration() {
82 public ConstraintDefinition getConstraints() {
87 public Set<AugmentationSchema> getAvailableAugmentations() {
92 public boolean isUserOrdered() {
97 public List<UnknownSchemaNode> getUnknownSchemaNodes() {
102 public int hashCode() {
103 final int prime = 31;
105 result = prime * result + Objects.hashCode(qname);
106 result = prime * result + Objects.hashCode(path);
111 public boolean equals(final Object obj) {
118 if (getClass() != obj.getClass()) {
121 final ListSchemaNodeImpl other = (ListSchemaNodeImpl) obj;
123 if (other.qname != null) {
126 } else if (!qname.equals(other.qname)) {
130 if (other.path != null) {
133 } else if (!path.equals(other.path)) {
140 public String toString() {
141 return "list " + qname.getLocalName();