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.LeafSchemaNode;
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;
24 * @deprecated Pre-Beryllium implementation, scheduled for removal.
27 final class LeafSchemaNodeImpl implements LeafSchemaNode, DerivableSchemaNode {
28 private final QName qname;
29 private final SchemaPath path;
35 LeafSchemaNode original;
36 boolean configuration;
37 ConstraintDefinition constraintsDef;
38 TypeDefinition<?> type;
39 ImmutableList<UnknownSchemaNode> unknownNodes;
43 LeafSchemaNodeImpl(final QName qname, final SchemaPath path) {
49 public QName getQName() {
54 public SchemaPath getPath() {
59 public String getDescription() {
64 public String getReference() {
69 public Status getStatus() {
74 public boolean isAugmenting() {
79 public boolean isAddedByUses() {
84 public Optional<LeafSchemaNode> getOriginal() {
85 return Optional.fromNullable(original);
89 public boolean isConfiguration() {
94 public ConstraintDefinition getConstraints() {
95 return constraintsDef;
99 public TypeDefinition<?> getType() {
104 public List<UnknownSchemaNode> getUnknownSchemaNodes() {
109 public String getDefault() {
114 public String getUnits() {
119 public int hashCode() {
120 final int prime = 31;
122 result = prime * result + Objects.hashCode(qname);
123 result = prime * result + Objects.hashCode(path);
128 public boolean equals(final Object obj) {
135 if (getClass() != obj.getClass()) {
138 LeafSchemaNodeImpl other = (LeafSchemaNodeImpl) obj;
140 if (other.qname != null) {
143 } else if (!qname.equals(other.qname)) {
147 if (other.path != null) {
150 } else if (!path.equals(other.path)) {
157 public String toString() {
158 return LeafSchemaNodeImpl.class.getSimpleName() + "[" +