blob: 417e07e572fd4a4437f3003ad9a89f97a021f330 [file] [log] [blame]
Vinod Kumar S6a6ce4c2016-02-11 20:13:28 +05301/*
Brian O'Connor0f7908b2016-04-09 01:19:45 -07002 * Copyright 2016-present Open Networking Laboratory
Vinod Kumar S6a6ce4c2016-02-11 20:13:28 +05303 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.onosproject.yangutils.datamodel;
17
18import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
19import org.onosproject.yangutils.parser.Parsable;
Gaurav Agrawaldb828bd2016-02-27 03:57:50 +053020import org.onosproject.yangutils.utils.YangConstructType;
Vinod Kumar S6a6ce4c2016-02-11 20:13:28 +053021
22/*-
23 * Reference 6020.
24 *
25 * The "belongs-to" statement specifies the module to which the
26 * submodule belongs. The argument is an identifier that is the name of
27 * the module.
28 *
29 * A submodule MUST only be included by the module to which it belongs,
30 * or by another submodule that belongs to that module.
31 *
32 * The mandatory "prefix" sub-statement assigns a prefix for the module
33 * to which the submodule belongs. All definitions in the local
34 * submodule and any included submodules can be accessed by using the
35 * prefix.
36 *
37 * The belongs-to's sub-statements
38 *
39 * +--------------+---------+-------------+
40 * | substatement | section | cardinality |
41 * +--------------+---------+-------------+
42 * | prefix | 7.1.4 | 1 |
43 * +--------------+---------+-------------+
44 */
45
46/**
Bharat saraswal63f26fb2016-04-05 15:13:44 +053047 * Represents the belongs-to data type information.
Vinod Kumar S6a6ce4c2016-02-11 20:13:28 +053048 */
49public class YangBelongsTo implements Parsable {
50
51 /**
52 * Reference RFC 6020.
53 *
54 * The "belongs-to" statement specifies the module to which the submodule
55 * belongs. The argument is an identifier that is the name of the module.
56 */
57 private String belongsToModuleName;
58
59 /**
Vidyashree Ramab6248172016-05-17 16:16:15 +053060 * Module node to which sub-module belongs to.
61 */
62 private YangNode moduleNode;
63
64 /**
Vinod Kumar S6a6ce4c2016-02-11 20:13:28 +053065 * Reference RFC 6020.
66 *
67 * The mandatory "prefix" substatement assigns a prefix for the module to
68 * which the submodule belongs. All definitions in the local submodule and
69 * any included submodules can be accessed by using the prefix.
70 */
71 private String prefix;
72
73 /**
74 * Create a belongs to object.
75 */
76 public YangBelongsTo() {
77
78 }
79
80 /**
Bharat saraswal63f26fb2016-04-05 15:13:44 +053081 * Returns the belongs to module name.
Vinod Kumar S6a6ce4c2016-02-11 20:13:28 +053082 *
83 * @return the belongs to module name
84 */
85 public String getBelongsToModuleName() {
86 return belongsToModuleName;
87 }
88
89 /**
Bharat saraswal63f26fb2016-04-05 15:13:44 +053090 * Sets the belongs to module name.
Vinod Kumar S6a6ce4c2016-02-11 20:13:28 +053091 *
92 * @param belongsToModuleName the belongs to module name to set
93 *
94 */
95 public void setBelongsToModuleName(String belongsToModuleName) {
96 this.belongsToModuleName = belongsToModuleName;
97 }
98
99 /**
Bharat saraswal63f26fb2016-04-05 15:13:44 +0530100 * Returns the prefix.
Vinod Kumar S6a6ce4c2016-02-11 20:13:28 +0530101 *
Gaurav Agrawaldb828bd2016-02-27 03:57:50 +0530102 * @return the prefix
Vinod Kumar S6a6ce4c2016-02-11 20:13:28 +0530103 */
104 public String getPrefix() {
105 return prefix;
106 }
107
108 /**
Bharat saraswal63f26fb2016-04-05 15:13:44 +0530109 * Sets the prefix.
Vinod Kumar S6a6ce4c2016-02-11 20:13:28 +0530110 *
111 * @param prefix the prefix to set
112 */
113 public void setPrefix(String prefix) {
114 this.prefix = prefix;
115 }
116
117 /**
Vidyashree Ramab6248172016-05-17 16:16:15 +0530118 * Returns the module data model node.
119 *
120 * @return the module data model node
121 */
122 public YangNode getModuleNode() {
123 return moduleNode;
124 }
125
126 /**
127 * Sets the module node.
128 *
129 * @param moduleNode module data model node
130 */
131 public void setModuleNode(YangNode moduleNode) {
132 this.moduleNode = moduleNode;
133 }
134
135 /**
Vinod Kumar S6a6ce4c2016-02-11 20:13:28 +0530136 * Returns the type of the data as belongs-to.
137 *
138 * @return ParsedDataType returns BELONGS_TO_DATA
139 */
Vinod Kumar Sc26bf192016-02-23 22:36:57 +0530140 @Override
Gaurav Agrawaldb828bd2016-02-27 03:57:50 +0530141 public YangConstructType getYangConstructType() {
142 return YangConstructType.BELONGS_TO_DATA;
Vinod Kumar S6a6ce4c2016-02-11 20:13:28 +0530143 }
144
145 /**
Bharat saraswal63f26fb2016-04-05 15:13:44 +0530146 * Validates the data on entering the corresponding parse tree node.
Vinod Kumar S6a6ce4c2016-02-11 20:13:28 +0530147 *
Gaurav Agrawaldb828bd2016-02-27 03:57:50 +0530148 * @throws DataModelException a violation of data model rules
Vinod Kumar S6a6ce4c2016-02-11 20:13:28 +0530149 */
Vinod Kumar Sc26bf192016-02-23 22:36:57 +0530150 @Override
Vinod Kumar S6a6ce4c2016-02-11 20:13:28 +0530151 public void validateDataOnEntry() throws DataModelException {
152 // TODO auto-generated method stub, to be implemented by parser
153 }
154
155 /**
Bharat saraswal63f26fb2016-04-05 15:13:44 +0530156 * Validates the data on exiting the corresponding parse tree node.
Vinod Kumar S6a6ce4c2016-02-11 20:13:28 +0530157 *
Gaurav Agrawaldb828bd2016-02-27 03:57:50 +0530158 * @throws DataModelException a violation of data model rules
Vinod Kumar S6a6ce4c2016-02-11 20:13:28 +0530159 */
Vinod Kumar Sc26bf192016-02-23 22:36:57 +0530160 @Override
Vinod Kumar S6a6ce4c2016-02-11 20:13:28 +0530161 public void validateDataOnExit() throws DataModelException {
162 // TODO auto-generated method stub, to be implemented by parser
163 }
164}