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.controller.yang.model.util;
10 import java.util.Collections;
11 import java.util.List;
13 import org.opendaylight.controller.yang.common.QName;
14 import org.opendaylight.controller.yang.model.api.SchemaPath;
15 import org.opendaylight.controller.yang.model.api.Status;
16 import org.opendaylight.controller.yang.model.api.UnknownSchemaNode;
17 import org.opendaylight.controller.yang.model.api.type.IdentityTypeDefinition;
20 * The <code>default</code> implementation of Identity Type Definition interface.
22 * @see IdentityTypeDefinition
24 public class IdentityType implements IdentityTypeDefinition {
26 private final QName name = BaseTypes.constructQName("identity");
27 private final SchemaPath path = BaseTypes.schemaPath(name);
28 private final String description = "The 'identity' statement is used to define a new " +
29 "globally unique, abstract, and untyped identity.";
30 private final String reference = "https://tools.ietf.org/html/rfc6020#section-7.16";
32 private String units = "";
33 private final QName identityName;
35 public IdentityType(QName identityName) {
37 this.identityName = identityName;
43 * @see org.opendaylight.controller.yang.model.api.TypeDefinition#getBaseType()
46 public IdentityTypeDefinition getBaseType() {
53 * @see org.opendaylight.controller.yang.model.api.TypeDefinition#getUnits()
56 public String getUnits() {
63 * @see org.opendaylight.controller.yang.model.api.TypeDefinition#getDefaultValue()
66 public Object getDefaultValue() {
73 * @see org.opendaylight.controller.yang.model.api.SchemaNode#getQName()
76 public QName getQName() {
77 // TODO Auto-generated method stub
84 * @see org.opendaylight.controller.yang.model.api.SchemaNode#getPath()
87 public SchemaPath getPath() {
94 * @see org.opendaylight.controller.yang.model.api.SchemaNode#getDescription()
97 public String getDescription() {
104 * @see org.opendaylight.controller.yang.model.api.SchemaNode#getReference()
107 public String getReference() {
114 * @see org.opendaylight.controller.yang.model.api.SchemaNode#getStatus()
117 public Status getStatus() {
118 return Status.CURRENT;
122 public List<UnknownSchemaNode> getUnknownSchemaNodes() {
123 return Collections.emptyList();
130 * org.opendaylight.controller.yang.model.base.type.api.IdentityTypeDefinition#getIdentityName
134 public QName getIdentityName() {
139 public int hashCode() {
140 final int prime = 31;
142 result = prime * result
143 + ((description == null) ? 0 : description.hashCode());
144 result = prime * result
145 + ((identityName == null) ? 0 : identityName.hashCode());
146 result = prime * result + ((name == null) ? 0 : name.hashCode());
147 result = prime * result + ((path == null) ? 0 : path.hashCode());
148 result = prime * result
149 + ((reference == null) ? 0 : reference.hashCode());
150 result = prime * result + ((units == null) ? 0 : units.hashCode());
155 public boolean equals(Object obj) {
162 if (getClass() != obj.getClass()) {
165 IdentityType other = (IdentityType) obj;
166 if (description == null) {
167 if (other.description != null) {
170 } else if (!description.equals(other.description)) {
173 if (identityName == null) {
174 if (other.identityName != null) {
177 } else if (!identityName.equals(other.identityName)) {
181 if (other.name != null) {
184 } else if (!name.equals(other.name)) {
188 if (other.path != null) {
191 } else if (!path.equals(other.path)) {
194 if (reference == null) {
195 if (other.reference != null) {
198 } else if (!reference.equals(other.reference)) {
202 if (other.units != null) {
205 } else if (!units.equals(other.units)) {
212 public String toString() {
213 StringBuilder builder = new StringBuilder();
214 builder.append("IdentityType [name=");
215 builder.append(name);
216 builder.append(", path=");
217 builder.append(path);
218 builder.append(", description=");
219 builder.append(description);
220 builder.append(", reference=");
221 builder.append(reference);
222 builder.append(", units=");
223 builder.append(units);
224 builder.append(", identityName=");
225 builder.append(identityName);
227 return builder.toString();