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.InstanceIdentifierTypeDefinition;
21 * The <code>default</code> implementation of Instance Identifier Type
22 * Definition interface.
24 * @see InstanceIdentifierTypeDefinition
26 public final class InstanceIdentifier implements InstanceIdentifierTypeDefinition {
27 private static final QName name = BaseTypes.constructQName("instance-identifier");
28 private static final SchemaPath path = new SchemaPath(Collections.singletonList(name), true);
29 private static final String description = "The instance-identifier built-in type is used to "
30 + "uniquely identify a particular instance node in the data tree.";
31 private static final String reference = "https://tools.ietf.org/html/rfc6020#section-9.13";
33 private final RevisionAwareXPath xpath;
34 private static final String units = "";
35 private boolean requireInstance = true;
37 public InstanceIdentifier(final RevisionAwareXPath xpath) {
41 public InstanceIdentifier(final RevisionAwareXPath xpath, final boolean requireInstance) {
43 this.requireInstance = requireInstance;
50 * org.opendaylight.yangtools.yang.model.api.TypeDefinition#getBaseType()
53 public InstanceIdentifierTypeDefinition getBaseType() {
60 * @see org.opendaylight.yangtools.yang.model.api.TypeDefinition#getUnits()
63 public String getUnits() {
71 * org.opendaylight.yangtools.yang.model.api.TypeDefinition#getDefaultValue
75 public Object getDefaultValue() {
82 * @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getQName()
85 public QName getQName() {
92 * @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getPath()
95 public SchemaPath getPath() {
103 * org.opendaylight.yangtools.yang.model.api.SchemaNode#getDescription()
106 public String getDescription() {
113 * @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getReference()
116 public String getReference() {
123 * @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getStatus()
126 public Status getStatus() {
127 return Status.CURRENT;
134 * org.opendaylight.yangtools.yang.model.api.SchemaNode#getExtensionSchemaNodes
138 public List<UnknownSchemaNode> getUnknownSchemaNodes() {
139 return Collections.emptyList();
145 * @see org.opendaylight.yangtools.yang.model.api.type.
146 * InstanceIdentifierTypeDefinition# getPathStatement()
149 public RevisionAwareXPath getPathStatement() {
156 * @see org.opendaylight.yangtools.yang.model.api.type.
157 * InstanceIdentifierTypeDefinition# requireInstance()
160 public boolean requireInstance() {
161 return requireInstance;
165 public int hashCode() {
166 final int prime = 31;
168 result = prime * result + (requireInstance ? 1231 : 1237);
169 result = prime * result + ((xpath == null) ? 0 : xpath.hashCode());
174 public boolean equals(Object obj) {
179 if (getClass() != obj.getClass())
181 InstanceIdentifier other = (InstanceIdentifier) obj;
182 if (requireInstance != other.requireInstance)
185 if (other.xpath != null)
187 } else if (!xpath.equals(other.xpath))