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.model.api.type.IdentityrefTypeDefinition;
\r
15 import org.opendaylight.controller.yang.common.QName;
\r
16 import org.opendaylight.controller.yang.model.api.ExtensionDefinition;
\r
17 import org.opendaylight.controller.yang.model.api.SchemaPath;
\r
18 import org.opendaylight.controller.yang.model.api.Status;
\r
20 public class Identityref implements IdentityrefTypeDefinition {
\r
22 private final QName name = BaseTypes.constructQName("identityref");
\r
23 private final SchemaPath path = BaseTypes.schemaPath(name);
\r
24 private final String description = "";
\r
25 private final String reference = "";
\r
27 private final IdentityTypeDefinition identity;
\r
29 private String units = "";
\r
31 public Identityref(IdentityTypeDefinition identity) {
\r
33 this.identity = identity;
\r
39 * @see org.opendaylight.controller.yang.model.api.TypeDefinition#getBaseType()
\r
42 public IdentityTypeDefinition getBaseType() {
\r
49 * @see org.opendaylight.controller.yang.model.api.TypeDefinition#getUnits()
\r
52 public String getUnits() {
\r
59 * @see org.opendaylight.controller.yang.model.api.TypeDefinition#getDefaultValue()
\r
62 public Object getDefaultValue() {
\r
69 * @see org.opendaylight.controller.yang.model.api.SchemaNode#getQName()
\r
72 public QName getQName() {
\r
79 * @see org.opendaylight.controller.yang.model.api.SchemaNode#getPath()
\r
82 public SchemaPath getPath() {
\r
89 * @see org.opendaylight.controller.yang.model.api.SchemaNode#getDescription()
\r
92 public String getDescription() {
\r
99 * @see org.opendaylight.controller.yang.model.api.SchemaNode#getReference()
\r
102 public String getReference() {
\r
109 * @see org.opendaylight.controller.yang.model.api.SchemaNode#getStatus()
\r
112 public Status getStatus() {
\r
113 return Status.CURRENT;
\r
117 public List<ExtensionDefinition> getExtensionSchemaNodes() {
\r
118 return Collections.emptyList();
\r
125 * org.opendaylight.controller.yang.model.base.type.api.IdentityrefTypeDefinition#getIdentityName
\r
129 public IdentityTypeDefinition getIdentity() {
\r
134 public int hashCode() {
\r
135 final int prime = 31;
\r
137 result = prime * result
\r
138 + ((description == null) ? 0 : description.hashCode());
\r
139 result = prime * result
\r
140 + ((identity == null) ? 0 : identity.hashCode());
\r
141 result = prime * result + ((name == null) ? 0 : name.hashCode());
\r
142 result = prime * result + ((path == null) ? 0 : path.hashCode());
\r
143 result = prime * result
\r
144 + ((reference == null) ? 0 : reference.hashCode());
\r
145 result = prime * result + ((units == null) ? 0 : units.hashCode());
\r
150 public boolean equals(Object obj) {
\r
157 if (getClass() != obj.getClass()) {
\r
160 Identityref other = (Identityref) obj;
\r
161 if (description == null) {
\r
162 if (other.description != null) {
\r
165 } else if (!description.equals(other.description)) {
\r
168 if (identity == null) {
\r
169 if (other.identity != null) {
\r
172 } else if (!identity.equals(other.identity)) {
\r
175 if (name == null) {
\r
176 if (other.name != null) {
\r
179 } else if (!name.equals(other.name)) {
\r
182 if (path == null) {
\r
183 if (other.path != null) {
\r
186 } else if (!path.equals(other.path)) {
\r
189 if (reference == null) {
\r
190 if (other.reference != null) {
\r
193 } else if (!reference.equals(other.reference)) {
\r
196 if (units == null) {
\r
197 if (other.units != null) {
\r
200 } else if (!units.equals(other.units)) {
\r
207 public String toString() {
\r
208 StringBuilder builder = new StringBuilder();
\r
209 builder.append("IdentityrefType [name=");
\r
210 builder.append(name);
\r
211 builder.append(", path=");
\r
212 builder.append(path);
\r
213 builder.append(", description=");
\r
214 builder.append(description);
\r
215 builder.append(", reference=");
\r
216 builder.append(reference);
\r
217 builder.append(", identity=");
\r
218 builder.append(identity);
\r
219 builder.append(", units=");
\r
220 builder.append(units);
\r
221 builder.append("]");
\r
222 return builder.toString();
\r