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