BUG-865: deprecate pre-Beryllium parser elements
[yangtools.git] / yang / yang-parser-impl / src / main / java / org / opendaylight / yangtools / yang / parser / builder / impl / LeafListSchemaNodeImpl.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.yangtools.yang.parser.builder.impl;
9
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;
22
23 /**
24  * @deprecated Pre-Beryllium implementation, scheduled for removal.
25  */
26 @Deprecated
27 final class LeafListSchemaNodeImpl implements LeafListSchemaNode, DerivableSchemaNode {
28     private final QName qname;
29     private final SchemaPath path;
30     String description;
31     String reference;
32     Status status;
33     boolean augmenting;
34     boolean addedByUses;
35     LeafListSchemaNode original;
36     boolean configuration;
37     ConstraintDefinition constraintsDef;
38     TypeDefinition<?> type;
39     boolean userOrdered;
40     ImmutableList<UnknownSchemaNode> unknownNodes;
41
42     LeafListSchemaNodeImpl(final QName qname, final SchemaPath path) {
43         this.qname = qname;
44         this.path = path;
45     }
46
47     @Override
48     public QName getQName() {
49         return qname;
50     }
51
52     @Override
53     public SchemaPath getPath() {
54         return path;
55     }
56
57     @Override
58     public String getDescription() {
59         return description;
60     }
61
62     @Override
63     public String getReference() {
64         return reference;
65     }
66
67     @Override
68     public Status getStatus() {
69         return status;
70     }
71
72     @Override
73     public boolean isAugmenting() {
74         return augmenting;
75     }
76
77     @Override
78     public boolean isAddedByUses() {
79         return addedByUses;
80     }
81
82     @Override
83     public Optional<LeafListSchemaNode> getOriginal() {
84         return Optional.fromNullable(original);
85     }
86
87     @Override
88     public boolean isConfiguration() {
89         return configuration;
90     }
91
92     @Override
93     public ConstraintDefinition getConstraints() {
94         return constraintsDef;
95     }
96
97     @Override
98     public TypeDefinition<?> getType() {
99         return type;
100     }
101
102     @Override
103     public boolean isUserOrdered() {
104         return userOrdered;
105     }
106
107     @Override
108     public List<UnknownSchemaNode> getUnknownSchemaNodes() {
109         return unknownNodes;
110     }
111
112     @Override
113     public int hashCode() {
114         final int prime = 31;
115         int result = 1;
116         result = prime * result + Objects.hashCode(qname);
117         result = prime * result + Objects.hashCode(path);
118         return result;
119     }
120
121     @Override
122     public boolean equals(final Object obj) {
123         if (this == obj) {
124             return true;
125         }
126         if (obj == null) {
127             return false;
128         }
129         if (getClass() != obj.getClass()) {
130             return false;
131         }
132         LeafListSchemaNodeImpl other = (LeafListSchemaNodeImpl) obj;
133         if (qname == null) {
134             if (other.qname != null) {
135                 return false;
136             }
137         } else if (!qname.equals(other.qname)) {
138             return false;
139         }
140         if (path == null) {
141             if (other.path != null) {
142                 return false;
143             }
144         } else if (!path.equals(other.path)) {
145             return false;
146         }
147         return true;
148     }
149
150     @Override
151     public String toString() {
152         StringBuilder sb = new StringBuilder(LeafListSchemaNodeImpl.class.getSimpleName());
153         sb.append("[");
154         sb.append(qname);
155         sb.append("]");
156         return sb.toString();
157     }
158 }