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.yangtools.yang.model.util;
10 import java.util.Collections;
11 import java.util.List;
13 import org.opendaylight.yangtools.yang.common.QName;
14 import org.opendaylight.yangtools.yang.model.api.RevisionAwareXPath;
15 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
16 import org.opendaylight.yangtools.yang.model.api.Status;
17 import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
18 import org.opendaylight.yangtools.yang.model.api.type.LeafrefTypeDefinition;
21 * The <code>default</code> implementation of Instance Leafref Type Definition
24 * @see LeafrefTypeDefinition
26 public final class Leafref implements LeafrefTypeDefinition {
27 private static final QName NAME = BaseTypes.constructQName("leafref");
28 private static final SchemaPath PATH = BaseTypes.schemaPath(NAME);
29 private static final String DESCRIPTION = "The leafref type is used to reference a particular leaf instance in the data tree.";
30 private static final String REF = "https://tools.ietf.org/html/rfc6020#section-9.9";
32 private final RevisionAwareXPath xpath;
34 public Leafref(final RevisionAwareXPath xpath) {
39 public LeafrefTypeDefinition getBaseType() {
44 public String getUnits() {
49 public Object getDefaultValue() {
54 public QName getQName() {
59 public SchemaPath getPath() {
64 public String getDescription() {
69 public String getReference() {
74 public Status getStatus() {
75 return Status.CURRENT;
79 public List<UnknownSchemaNode> getUnknownSchemaNodes() {
80 return Collections.emptyList();
84 public RevisionAwareXPath getPathStatement() {
89 public int hashCode() {
92 result = prime * result + ((xpath == null) ? 0 : xpath.hashCode());
97 public boolean equals(Object obj) {
104 if (getClass() != obj.getClass()) {
107 Leafref other = (Leafref) obj;
109 if (other.xpath != null) {
112 } else if (!xpath.equals(other.xpath)) {
119 public String toString() {
120 StringBuilder builder = new StringBuilder();
121 builder.append("type ");
122 builder.append(NAME);
123 builder.append(" [xpath=");
124 builder.append(xpath);
126 return builder.toString();