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.LeafrefTypeDefinition;
\r
14 import org.opendaylight.controller.yang.common.QName;
\r
15 import org.opendaylight.controller.yang.model.api.RevisionAwareXPath;
\r
16 import org.opendaylight.controller.yang.model.api.SchemaPath;
\r
17 import org.opendaylight.controller.yang.model.api.Status;
\r
18 import org.opendaylight.controller.yang.model.api.UnknownSchemaNode;
\r
20 public class Leafref implements LeafrefTypeDefinition {
\r
21 private static final QName name = BaseTypes.constructQName("leafref");
\r
22 private static final String description = "";
\r
23 private static final String reference = "";
\r
24 private final SchemaPath path = BaseTypes.schemaPath(name);
\r
25 private final RevisionAwareXPath xpath;
\r
26 private final String units = "";
\r
28 public Leafref(RevisionAwareXPath xpath) {
\r
36 * @see org.opendaylight.controller.yang.model.api.TypeDefinition#getBaseType()
\r
39 public LeafrefTypeDefinition getBaseType() {
\r
46 * @see org.opendaylight.controller.yang.model.api.TypeDefinition#getUnits()
\r
49 public String getUnits() {
\r
56 * @see org.opendaylight.controller.yang.model.api.TypeDefinition#getDefaultValue()
\r
59 public Object getDefaultValue() {
\r
66 * @see org.opendaylight.controller.yang.model.api.SchemaNode#getQName()
\r
69 public QName getQName() {
\r
76 * @see org.opendaylight.controller.yang.model.api.SchemaNode#getPath()
\r
79 public SchemaPath getPath() {
\r
86 * @see org.opendaylight.controller.yang.model.api.SchemaNode#getDescription()
\r
89 public String getDescription() {
\r
96 * @see org.opendaylight.controller.yang.model.api.SchemaNode#getReference()
\r
99 public String getReference() {
\r
106 * @see org.opendaylight.controller.yang.model.api.SchemaNode#getStatus()
\r
109 public Status getStatus() {
\r
110 return Status.CURRENT;
\r
116 * @see org.opendaylight.controller.yang.model.api.SchemaNode#getExtensionSchemaNodes()
\r
119 public List<UnknownSchemaNode> getUnknownSchemaNodes() {
\r
120 return Collections.emptyList();
\r
127 * org.opendaylight.controller.yang.model.api.type.LeafrefTypeDefinition#getPathStatement()
\r
130 public RevisionAwareXPath getPathStatement() {
\r
135 public int hashCode() {
\r
136 final int prime = 31;
\r
138 result = prime * result + ((path == null) ? 0 : path.hashCode());
\r
139 result = prime * result + ((units == null) ? 0 : units.hashCode());
\r
140 result = prime * result + ((xpath == null) ? 0 : xpath.hashCode());
\r
145 public boolean equals(Object obj) {
\r
152 if (getClass() != obj.getClass()) {
\r
155 Leafref other = (Leafref) obj;
\r
156 if (path == null) {
\r
157 if (other.path != null) {
\r
160 } else if (!path.equals(other.path)) {
\r
163 if (units == null) {
\r
164 if (other.units != null) {
\r
167 } else if (!units.equals(other.units)) {
\r
170 if (xpath == null) {
\r
171 if (other.xpath != null) {
\r
174 } else if (!xpath.equals(other.xpath)) {
\r
181 public String toString() {
\r
182 StringBuilder builder = new StringBuilder();
\r
183 builder.append("Leafref [path=");
\r
184 builder.append(path);
\r
185 builder.append(", xpath=");
\r
186 builder.append(xpath);
\r
187 builder.append(", units=");
\r
188 builder.append(units);
\r
189 builder.append("]");
\r
190 return builder.toString();
\r