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