BUG-865: deprecate pre-Beryllium parser elements
[yangtools.git] / yang / yang-parser-impl / src / main / java / org / opendaylight / yangtools / yang / parser / builder / impl / ExtensionDefinitionImpl.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.collect.ImmutableList;
11 import java.util.List;
12 import java.util.Objects;
13 import org.opendaylight.yangtools.yang.common.QName;
14 import org.opendaylight.yangtools.yang.model.api.ExtensionDefinition;
15 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
16 import org.opendaylight.yangtools.yang.model.api.Status;
17 import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
18
19 /**
20  * @deprecated Pre-Beryllium implementation, scheduled for removal.
21  */
22 @Deprecated
23 final class ExtensionDefinitionImpl implements ExtensionDefinition {
24     private final QName qname;
25     String argument;
26     private final SchemaPath schemaPath;
27     String description;
28     String reference;
29     Status status;
30     ImmutableList<UnknownSchemaNode> unknownNodes;
31     boolean yin;
32
33     ExtensionDefinitionImpl(final QName qname, final SchemaPath path) {
34         this.qname = qname;
35         this.schemaPath = path;
36     }
37
38     @Override
39     public QName getQName() {
40         return qname;
41     }
42
43     @Override
44     public SchemaPath getPath() {
45         return schemaPath;
46     }
47
48     @Override
49     public String getDescription() {
50         return description;
51     }
52
53     @Override
54     public String getReference() {
55         return reference;
56     }
57
58     @Override
59     public Status getStatus() {
60         return status;
61     }
62
63     @Override
64     public List<UnknownSchemaNode> getUnknownSchemaNodes() {
65         return unknownNodes;
66     }
67
68     @Override
69     public String getArgument() {
70         return argument;
71     }
72
73     @Override
74     public boolean isYinElement() {
75         return yin;
76     }
77
78     @Override
79     public int hashCode() {
80         final int prime = 31;
81         int result = 1;
82         result = prime * result + Objects.hashCode(qname);
83         result = prime * result + Objects.hashCode(schemaPath);
84         return result;
85     }
86
87     @Override
88     public boolean equals(final Object obj) {
89         if (this == obj) {
90             return true;
91         }
92         if (obj == null) {
93             return false;
94         }
95         if (getClass() != obj.getClass()) {
96             return false;
97         }
98         ExtensionDefinitionImpl other = (ExtensionDefinitionImpl) obj;
99         if (qname == null) {
100             if (other.qname != null) {
101                 return false;
102             }
103         } else if (!qname.equals(other.qname)) {
104             return false;
105         }
106         if (schemaPath == null) {
107             if (other.schemaPath != null) {
108                 return false;
109             }
110         } else if (!schemaPath.equals(other.schemaPath)) {
111             return false;
112         }
113         return true;
114     }
115
116     @Override
117     public String toString() {
118         StringBuilder sb = new StringBuilder(ExtensionDefinitionImpl.class.getSimpleName());
119         sb.append("[");
120         sb.append("argument=").append(argument);
121         sb.append(", qname=").append(qname);
122         sb.append(", schemaPath=").append(schemaPath);
123         sb.append(", extensionSchemaNodes=").append(unknownNodes);
124         sb.append(", yin=").append(yin);
125         sb.append("]");
126         return sb.toString();
127     }
128 }