blob: 7fd8a1a0fed626a4472fd6f8ecc0858f7dddd852 [file] [log] [blame]
Vinod Kumar S67e7be62016-02-11 20:13:28 +05301/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2016-present Open Networking Laboratory
Vinod Kumar S67e7be62016-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 Agrawal8e8770a2016-02-27 03:57:50 +053020import org.onosproject.yangutils.utils.YangConstructType;
Vinod Kumar S67e7be62016-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 saraswald9822e92016-04-05 15:13:44 +053047 * Represents the belongs-to data type information.
Vinod Kumar S67e7be62016-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 /**
60 * Reference RFC 6020.
61 *
62 * The mandatory "prefix" substatement assigns a prefix for the module to
63 * which the submodule belongs. All definitions in the local submodule and
64 * any included submodules can be accessed by using the prefix.
65 */
66 private String prefix;
67
68 /**
69 * Create a belongs to object.
70 */
71 public YangBelongsTo() {
72
73 }
74
75 /**
Bharat saraswald9822e92016-04-05 15:13:44 +053076 * Returns the belongs to module name.
Vinod Kumar S67e7be62016-02-11 20:13:28 +053077 *
78 * @return the belongs to module name
79 */
80 public String getBelongsToModuleName() {
81 return belongsToModuleName;
82 }
83
84 /**
Bharat saraswald9822e92016-04-05 15:13:44 +053085 * Sets the belongs to module name.
Vinod Kumar S67e7be62016-02-11 20:13:28 +053086 *
87 * @param belongsToModuleName the belongs to module name to set
88 *
89 */
90 public void setBelongsToModuleName(String belongsToModuleName) {
91 this.belongsToModuleName = belongsToModuleName;
92 }
93
94 /**
Bharat saraswald9822e92016-04-05 15:13:44 +053095 * Returns the prefix.
Vinod Kumar S67e7be62016-02-11 20:13:28 +053096 *
Gaurav Agrawal8e8770a2016-02-27 03:57:50 +053097 * @return the prefix
Vinod Kumar S67e7be62016-02-11 20:13:28 +053098 */
99 public String getPrefix() {
100 return prefix;
101 }
102
103 /**
Bharat saraswald9822e92016-04-05 15:13:44 +0530104 * Sets the prefix.
Vinod Kumar S67e7be62016-02-11 20:13:28 +0530105 *
106 * @param prefix the prefix to set
107 */
108 public void setPrefix(String prefix) {
109 this.prefix = prefix;
110 }
111
112 /**
113 * Returns the type of the data as belongs-to.
114 *
115 * @return ParsedDataType returns BELONGS_TO_DATA
116 */
Vinod Kumar S0c330cd2016-02-23 22:36:57 +0530117 @Override
Gaurav Agrawal8e8770a2016-02-27 03:57:50 +0530118 public YangConstructType getYangConstructType() {
119 return YangConstructType.BELONGS_TO_DATA;
Vinod Kumar S67e7be62016-02-11 20:13:28 +0530120 }
121
122 /**
Bharat saraswald9822e92016-04-05 15:13:44 +0530123 * Validates the data on entering the corresponding parse tree node.
Vinod Kumar S67e7be62016-02-11 20:13:28 +0530124 *
Gaurav Agrawal8e8770a2016-02-27 03:57:50 +0530125 * @throws DataModelException a violation of data model rules
Vinod Kumar S67e7be62016-02-11 20:13:28 +0530126 */
Vinod Kumar S0c330cd2016-02-23 22:36:57 +0530127 @Override
Vinod Kumar S67e7be62016-02-11 20:13:28 +0530128 public void validateDataOnEntry() throws DataModelException {
129 // TODO auto-generated method stub, to be implemented by parser
130 }
131
132 /**
Bharat saraswald9822e92016-04-05 15:13:44 +0530133 * Validates the data on exiting the corresponding parse tree node.
Vinod Kumar S67e7be62016-02-11 20:13:28 +0530134 *
Gaurav Agrawal8e8770a2016-02-27 03:57:50 +0530135 * @throws DataModelException a violation of data model rules
Vinod Kumar S67e7be62016-02-11 20:13:28 +0530136 */
Vinod Kumar S0c330cd2016-02-23 22:36:57 +0530137 @Override
Vinod Kumar S67e7be62016-02-11 20:13:28 +0530138 public void validateDataOnExit() throws DataModelException {
139 // TODO auto-generated method stub, to be implemented by parser
140 }
141}