Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016 Open Networking Laboratory |
| 3 | * |
| 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 | */ |
| 16 | package org.onosproject.yangutils.datamodel; |
| 17 | |
| 18 | import org.onosproject.yangutils.datamodel.exceptions.DataModelException; |
| 19 | import org.onosproject.yangutils.parser.Parsable; |
| 20 | import org.onosproject.yangutils.parser.ParsableDataType; |
| 21 | |
| 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 | /** |
| 47 | * Maintains the belongs-to data type information. |
| 48 | */ |
| 49 | public 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 | /** |
| 76 | * Get the belongs to module name. |
| 77 | * |
| 78 | * @return the belongs to module name |
| 79 | */ |
| 80 | public String getBelongsToModuleName() { |
| 81 | return belongsToModuleName; |
| 82 | } |
| 83 | |
| 84 | /** |
| 85 | * Set the belongs to module name. |
| 86 | * |
| 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 | /** |
| 95 | * Get the prefix. |
| 96 | * |
| 97 | * @return the prefix. |
| 98 | */ |
| 99 | public String getPrefix() { |
| 100 | return prefix; |
| 101 | } |
| 102 | |
| 103 | /** |
| 104 | * Set the prefix. |
| 105 | * |
| 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 S | c26bf19 | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 117 | @Override |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 118 | public ParsableDataType getParsableDataType() { |
| 119 | return ParsableDataType.BELONGS_TO_DATA; |
| 120 | } |
| 121 | |
| 122 | /** |
| 123 | * Validate the data on entering the corresponding parse tree node. |
| 124 | * |
| 125 | * @throws DataModelException a violation of data model rules. |
| 126 | */ |
Vinod Kumar S | c26bf19 | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 127 | @Override |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 128 | public void validateDataOnEntry() throws DataModelException { |
| 129 | // TODO auto-generated method stub, to be implemented by parser |
| 130 | } |
| 131 | |
| 132 | /** |
| 133 | * Validate the data on exiting the corresponding parse tree node. |
| 134 | * |
| 135 | * @throws DataModelException a violation of data model rules. |
| 136 | */ |
Vinod Kumar S | c26bf19 | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 137 | @Override |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 138 | public void validateDataOnExit() throws DataModelException { |
| 139 | // TODO auto-generated method stub, to be implemented by parser |
| 140 | } |
| 141 | } |