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