blob: be3f8458908d00211f29369def818a2c38615804 [file] [log] [blame]
Vinod Kumar S2ff139c2016-02-16 01:37:16 +05301/*
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
17package org.onosproject.yangutils.datamodel;
18
19import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
20import org.onosproject.yangutils.parser.Parsable;
21import org.onosproject.yangutils.parser.ParsableDataType;
22
23/*-
24 * The "ENUM" statement, which is a sub-statement to the "type"
25 * statement, MUST be present if the type is "enumeration". It is
26 * repeatedly used to specify each assigned name of an enumeration type.
27 * It takes as an argument a string which is the assigned name. The
28 * string MUST NOT be empty and MUST NOT have any leading or trailing
29 * whitespace characters. The use of Unicode control codes SHOULD be
30 * avoided.
31 *
32 * The statement is optionally followed by a block of sub-statements that
33 * holds detailed ENUM information.
34 * All assigned names in an enumeration MUST be unique.
35 *
36 * The ENUM's sub-statements
37 *
38 * +--------------+---------+-------------+------------------+
39 * | substatement | section | cardinality |data model mapping|
40 * +--------------+---------+-------------+------------------+
41 * | description | 7.19.3 | 0..1 | - string |
42 * | reference | 7.19.4 | 0..1 | - string |
43 * | status | 7.19.2 | 0..1 | - YangStatus |
44 * | value | 9.6.4.2 | 0..1 | - int |
45 * +--------------+---------+-------------+------------------+
46 */
47
48/**
49 * Maintains the ENUM data type information.
50 */
51public class YangEnum implements YangCommonInfo, Parsable {
52
53 /**
54 * Named value for the ENUM.
55 */
56 private String namedValue;
57
58 /**
59 * Description of the ENUM value.
60 */
61 private String description;
62
63 /**
64 * Reference info of the ENUM value.
65 */
66 private String reference;
67
68 /**
69 * Status of the ENUM value.
70 */
71 private YangStatusType status;
72
73 /**
74 * value of ENUM.
75 */
76 private int value;
77
78 /**
79 * Create a YANG ENUM.
80 */
81 public YangEnum() {
82
83 }
84
85 /**
86 * Get the named value.
87 *
88 * @return the named value.
89 */
90 public String getNamedValue() {
91 return namedValue;
92 }
93
94 /**
95 * Set the named value.
96 *
97 * @param namedValue the named value to set.
98 */
99 public void setNamedValue(String namedValue) {
100 this.namedValue = namedValue;
101 }
102
103 /**
104 * Get the description.
105 *
106 * @return the description.
107 */
108 public String getDescription() {
109 return description;
110 }
111
112 /**
113 * Set the description.
114 *
115 * @param description set the description.
116 */
117 public void setDescription(String description) {
118 this.description = description;
119 }
120
121 /**
122 * Get the textual reference.
123 *
124 * @return the reference.
125 */
126 public String getReference() {
127 return reference;
128 }
129
130 /**
131 * Set the textual reference.
132 *
133 * @param reference the reference to set.
134 */
135 public void setReference(String reference) {
136 this.reference = reference;
137 }
138
139 /**
140 * Get the status.
141 *
142 * @return the status.
143 */
144 public YangStatusType getStatus() {
145 return status;
146 }
147
148 /**
149 * Set the status.
150 *
151 * @param status the status to set.
152 */
153 public void setStatus(YangStatusType status) {
154 this.status = status;
155 }
156
157 /**
158 * Get the value.
159 *
160 * @return the value.
161 */
162 public int getValue() {
163 return value;
164 }
165
166 /**
167 * Set the value.
168 *
169 * @param value the value to set.
170 */
171 public void setValue(int value) {
172 this.value = value;
173 }
174
175 /**
176 * Returns the type of the data.
177 *
178 * @return ParsedDataType returns ENUM_DATA
179 */
180 public ParsableDataType getParsableDataType() {
181 return ParsableDataType.ENUM_DATA;
182 }
183
184 /**
185 * Validate the data on entering the corresponding parse tree node.
186 *
187 * @throws DataModelException a violation of data model rules.
188 */
189 public void validateDataOnEntry() throws DataModelException {
190 // TODO auto-generated method stub, to be implemented by parser
191 }
192
193 /**
194 * Validate the data on exiting the corresponding parse tree node.
195 *
196 * @throws DataModelException a violation of data model rules.
197 */
198 public void validateDataOnExit() throws DataModelException {
199 // TODO auto-generated method stub, to be implemented by parser
200 }
201}