Merge from development repository.
[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 public class InstanceIdentifier implements InstanceIdentifierTypeDefinition {\r
21 \r
22     private static final QName name = BaseTypes\r
23             .constructQName("instance-identifier");\r
24     private static final String description = "";\r
25     private static final String reference = "";\r
26 \r
27     private final transient SchemaPath path = BaseTypes.schemaPath(name);\r
28     private final RevisionAwareXPath xpath;\r
29     private final String units = "";\r
30 \r
31     private final boolean requireInstance;\r
32 \r
33     public InstanceIdentifier(RevisionAwareXPath xpath, boolean requireInstance) {\r
34         super();\r
35         this.xpath = xpath;\r
36         this.requireInstance = requireInstance;\r
37     }\r
38 \r
39     /*\r
40      * (non-Javadoc)\r
41      * \r
42      * @see org.opendaylight.controller.yang.model.api.TypeDefinition#getBaseType()\r
43      */\r
44     @Override\r
45     public InstanceIdentifierTypeDefinition getBaseType() {\r
46         return this;\r
47     }\r
48 \r
49     /*\r
50      * (non-Javadoc)\r
51      * \r
52      * @see org.opendaylight.controller.yang.model.api.TypeDefinition#getUnits()\r
53      */\r
54     @Override\r
55     public String getUnits() {\r
56         return units;\r
57     }\r
58 \r
59     /*\r
60      * (non-Javadoc)\r
61      * \r
62      * @see org.opendaylight.controller.yang.model.api.TypeDefinition#getDefaultValue()\r
63      */\r
64     @Override\r
65     public Object getDefaultValue() {\r
66         return xpath;\r
67     }\r
68 \r
69     /*\r
70      * (non-Javadoc)\r
71      * \r
72      * @see org.opendaylight.controller.yang.model.api.SchemaNode#getQName()\r
73      */\r
74     @Override\r
75     public QName getQName() {\r
76         return name;\r
77     }\r
78 \r
79     /*\r
80      * (non-Javadoc)\r
81      * \r
82      * @see org.opendaylight.controller.yang.model.api.SchemaNode#getPath()\r
83      */\r
84     @Override\r
85     public SchemaPath getPath() {\r
86         return path;\r
87     }\r
88 \r
89     /*\r
90      * (non-Javadoc)\r
91      * \r
92      * @see org.opendaylight.controller.yang.model.api.SchemaNode#getDescription()\r
93      */\r
94     @Override\r
95     public String getDescription() {\r
96         return description;\r
97     }\r
98 \r
99     /*\r
100      * (non-Javadoc)\r
101      * \r
102      * @see org.opendaylight.controller.yang.model.api.SchemaNode#getReference()\r
103      */\r
104     @Override\r
105     public String getReference() {\r
106         return reference;\r
107     }\r
108 \r
109     /*\r
110      * (non-Javadoc)\r
111      * \r
112      * @see org.opendaylight.controller.yang.model.api.SchemaNode#getStatus()\r
113      */\r
114     @Override\r
115     public Status getStatus() {\r
116         return Status.CURRENT;\r
117     }\r
118 \r
119     /*\r
120      * (non-Javadoc)\r
121      * \r
122      * @see org.opendaylight.controller.yang.model.api.SchemaNode#getExtensionSchemaNodes()\r
123      */\r
124     @Override\r
125     public List<UnknownSchemaNode> getUnknownSchemaNodes() {\r
126         return Collections.emptyList();\r
127     }\r
128 \r
129     /*\r
130      * (non-Javadoc)\r
131      * \r
132      * @see org.opendaylight.controller.yang.model.api.type.InstanceIdentifierTypeDefinition#\r
133      * getPathStatement()\r
134      */\r
135     @Override\r
136     public RevisionAwareXPath getPathStatement() {\r
137         return xpath;\r
138     }\r
139 \r
140     /*\r
141      * (non-Javadoc)\r
142      * \r
143      * @see org.opendaylight.controller.yang.model.api.type.InstanceIdentifierTypeDefinition#\r
144      * requireInstance()\r
145      */\r
146     @Override\r
147     public boolean requireInstance() {\r
148         return requireInstance;\r
149     }\r
150 \r
151 }\r