Updated YANG Type definitions and documentation in YANG Model Utils.
[controller.git] / opendaylight / sal / yang-prototype / yang / yang-model-util / src / main / java / org / opendaylight / controller / model / util / InstanceIdentifier.java
1 /*\r
2   * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.\r
3   *\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
7   */\r
8 package org.opendaylight.controller.model.util;\r
9 \r
10 import java.util.Collections;\r
11 import java.util.List;\r
12 \r
13 import org.opendaylight.controller.model.api.type.InstanceIdentifierTypeDefinition;\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
19 \r
20 /**\r
21  * The <code>default</code> implementation of Instance Identifier Type Definition interface.\r
22  *\r
23  * @see InstanceIdentifierTypeDefinition\r
24  */\r
25 public class InstanceIdentifier implements InstanceIdentifierTypeDefinition {\r
26 \r
27     private static final QName name = BaseTypes\r
28             .constructQName("instance-identifier");\r
29     private static final String description = "The instance-identifier built-in type is used to " +\r
30                 "uniquely identify a particular instance node in the data tree.";\r
31     private static final String reference = "https://tools.ietf.org/html/rfc6020#section-9.13";\r
32 \r
33     private final transient SchemaPath path = BaseTypes.schemaPath(name);\r
34     private final RevisionAwareXPath xpath;\r
35     private final String units = "";\r
36 \r
37     private final boolean requireInstance;\r
38 \r
39     public InstanceIdentifier(RevisionAwareXPath xpath, boolean requireInstance) {\r
40         super();\r
41         this.xpath = xpath;\r
42         this.requireInstance = requireInstance;\r
43     }\r
44 \r
45     /*\r
46      * (non-Javadoc)\r
47      * \r
48      * @see org.opendaylight.controller.yang.model.api.TypeDefinition#getBaseType()\r
49      */\r
50     @Override\r
51     public InstanceIdentifierTypeDefinition getBaseType() {\r
52         return this;\r
53     }\r
54 \r
55     /*\r
56      * (non-Javadoc)\r
57      * \r
58      * @see org.opendaylight.controller.yang.model.api.TypeDefinition#getUnits()\r
59      */\r
60     @Override\r
61     public String getUnits() {\r
62         return units;\r
63     }\r
64 \r
65     /*\r
66      * (non-Javadoc)\r
67      * \r
68      * @see org.opendaylight.controller.yang.model.api.TypeDefinition#getDefaultValue()\r
69      */\r
70     @Override\r
71     public Object getDefaultValue() {\r
72         return xpath;\r
73     }\r
74 \r
75     /*\r
76      * (non-Javadoc)\r
77      * \r
78      * @see org.opendaylight.controller.yang.model.api.SchemaNode#getQName()\r
79      */\r
80     @Override\r
81     public QName getQName() {\r
82         return name;\r
83     }\r
84 \r
85     /*\r
86      * (non-Javadoc)\r
87      * \r
88      * @see org.opendaylight.controller.yang.model.api.SchemaNode#getPath()\r
89      */\r
90     @Override\r
91     public SchemaPath getPath() {\r
92         return path;\r
93     }\r
94 \r
95     /*\r
96      * (non-Javadoc)\r
97      * \r
98      * @see org.opendaylight.controller.yang.model.api.SchemaNode#getDescription()\r
99      */\r
100     @Override\r
101     public String getDescription() {\r
102         return description;\r
103     }\r
104 \r
105     /*\r
106      * (non-Javadoc)\r
107      * \r
108      * @see org.opendaylight.controller.yang.model.api.SchemaNode#getReference()\r
109      */\r
110     @Override\r
111     public String getReference() {\r
112         return reference;\r
113     }\r
114 \r
115     /*\r
116      * (non-Javadoc)\r
117      * \r
118      * @see org.opendaylight.controller.yang.model.api.SchemaNode#getStatus()\r
119      */\r
120     @Override\r
121     public Status getStatus() {\r
122         return Status.CURRENT;\r
123     }\r
124 \r
125     /*\r
126      * (non-Javadoc)\r
127      * \r
128      * @see org.opendaylight.controller.yang.model.api.SchemaNode#getExtensionSchemaNodes()\r
129      */\r
130     @Override\r
131     public List<UnknownSchemaNode> getUnknownSchemaNodes() {\r
132         return Collections.emptyList();\r
133     }\r
134 \r
135     /*\r
136      * (non-Javadoc)\r
137      * \r
138      * @see org.opendaylight.controller.yang.model.api.type.InstanceIdentifierTypeDefinition#\r
139      * getPathStatement()\r
140      */\r
141     @Override\r
142     public RevisionAwareXPath getPathStatement() {\r
143         return xpath;\r
144     }\r
145 \r
146     /*\r
147      * (non-Javadoc)\r
148      * \r
149      * @see org.opendaylight.controller.yang.model.api.type.InstanceIdentifierTypeDefinition#\r
150      * requireInstance()\r
151      */\r
152     @Override\r
153     public boolean requireInstance() {\r
154         return requireInstance;\r
155     }\r
156 \r
157 }\r