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.ExtensionDefinition;
\r
16 import org.opendaylight.controller.yang.model.api.SchemaPath;
\r
17 import org.opendaylight.controller.yang.model.api.Status;
\r
19 public class IdentityType implements IdentityTypeDefinition {
\r
21 private final QName name = BaseTypes.constructQName("identity");
\r
22 private final SchemaPath path = BaseTypes.schemaPath(name);
\r
23 private final String description = "";
\r
24 private final String reference = "";
\r
26 private String units = "";
\r
27 private final QName identityName;
\r
29 public IdentityType(QName identityName) {
\r
31 this.identityName = identityName;
\r
37 * @see org.opendaylight.controller.yang.model.api.TypeDefinition#getBaseType()
\r
40 public IdentityTypeDefinition getBaseType() {
\r
47 * @see org.opendaylight.controller.yang.model.api.TypeDefinition#getUnits()
\r
50 public String getUnits() {
\r
57 * @see org.opendaylight.controller.yang.model.api.TypeDefinition#getDefaultValue()
\r
60 public Object getDefaultValue() {
\r
67 * @see org.opendaylight.controller.yang.model.api.SchemaNode#getQName()
\r
70 public QName getQName() {
\r
71 // TODO Auto-generated method stub
\r
78 * @see org.opendaylight.controller.yang.model.api.SchemaNode#getPath()
\r
81 public SchemaPath getPath() {
\r
88 * @see org.opendaylight.controller.yang.model.api.SchemaNode#getDescription()
\r
91 public String getDescription() {
\r
98 * @see org.opendaylight.controller.yang.model.api.SchemaNode#getReference()
\r
101 public String getReference() {
\r
108 * @see org.opendaylight.controller.yang.model.api.SchemaNode#getStatus()
\r
111 public Status getStatus() {
\r
112 return Status.CURRENT;
\r
116 public List<ExtensionDefinition> getExtensionSchemaNodes() {
\r
117 return Collections.emptyList();
\r
124 * org.opendaylight.controller.yang.model.base.type.api.IdentityTypeDefinition#getIdentityName
\r
128 public QName getIdentityName() {
\r
129 return identityName;
\r
133 public int hashCode() {
\r
134 final int prime = 31;
\r
136 result = prime * result
\r
137 + ((description == null) ? 0 : description.hashCode());
\r
138 result = prime * result
\r
139 + ((identityName == null) ? 0 : identityName.hashCode());
\r
140 result = prime * result + ((name == null) ? 0 : name.hashCode());
\r
141 result = prime * result + ((path == null) ? 0 : path.hashCode());
\r
142 result = prime * result
\r
143 + ((reference == null) ? 0 : reference.hashCode());
\r
144 result = prime * result + ((units == null) ? 0 : units.hashCode());
\r
149 public boolean equals(Object obj) {
\r
156 if (getClass() != obj.getClass()) {
\r
159 IdentityType other = (IdentityType) obj;
\r
160 if (description == null) {
\r
161 if (other.description != null) {
\r
164 } else if (!description.equals(other.description)) {
\r
167 if (identityName == null) {
\r
168 if (other.identityName != null) {
\r
171 } else if (!identityName.equals(other.identityName)) {
\r
174 if (name == null) {
\r
175 if (other.name != null) {
\r
178 } else if (!name.equals(other.name)) {
\r
181 if (path == null) {
\r
182 if (other.path != null) {
\r
185 } else if (!path.equals(other.path)) {
\r
188 if (reference == null) {
\r
189 if (other.reference != null) {
\r
192 } else if (!reference.equals(other.reference)) {
\r
195 if (units == null) {
\r
196 if (other.units != null) {
\r
199 } else if (!units.equals(other.units)) {
\r
206 public String toString() {
\r
207 StringBuilder builder = new StringBuilder();
\r
208 builder.append("IdentityType [name=");
\r
209 builder.append(name);
\r
210 builder.append(", path=");
\r
211 builder.append(path);
\r
212 builder.append(", description=");
\r
213 builder.append(description);
\r
214 builder.append(", reference=");
\r
215 builder.append(reference);
\r
216 builder.append(", units=");
\r
217 builder.append(units);
\r
218 builder.append(", identityName=");
\r
219 builder.append(identityName);
\r
220 builder.append("]");
\r
221 return builder.toString();
\r