blob: def4cc91b2e01fd7dcefcd23a89dd8434b559dbd [file] [log] [blame]
Bharat saraswal708abc02016-02-12 20:48:30 +05301/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2016-present Open Networking Laboratory
Bharat saraswal708abc02016-02-12 20:48:30 +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 */
16
17package org.onosproject.yangutils.utils;
18
Vinod Kumar S38046502016-03-23 15:30:27 +053019import java.io.File;
b.janani1fef2732016-03-04 12:29:05 +053020import java.util.Arrays;
21import java.util.List;
22
Bharat saraswal708abc02016-02-12 20:48:30 +053023/**
Bharat saraswald9822e92016-04-05 15:13:44 +053024 * Represents utilities constants which are used while generating java files.
Bharat saraswal708abc02016-02-12 20:48:30 +053025 */
26public final class UtilConstants {
27
28 /**
Bharat saraswald9822e92016-04-05 15:13:44 +053029 * Creates an instance of util constants.
Bharat saraswal708abc02016-02-12 20:48:30 +053030 */
31 private UtilConstants() {
32 }
33
34 /**
Bharat saraswal2f11f652016-03-25 18:19:46 +053035 * JavaDocs for impl class.
Bharat saraswal708abc02016-02-12 20:48:30 +053036 */
Gaurav Agrawal338735b2016-04-18 18:53:11 +053037 public static final String IMPL_CLASS_JAVA_DOC = " * Represents the implementation of ";
Bharat saraswal2f11f652016-03-25 18:19:46 +053038
39 /**
40 * JavaDocs for builder class.
41 */
Gaurav Agrawal338735b2016-04-18 18:53:11 +053042 public static final String BUILDER_CLASS_JAVA_DOC = " * Represents the builder implementation of ";
Bharat saraswal2f11f652016-03-25 18:19:46 +053043
44 /**
45 * JavaDocs for interface class.
46 */
Gaurav Agrawal338735b2016-04-18 18:53:11 +053047 public static final String INTERFACE_JAVA_DOC = " * Abstraction of an entity which represents the"
48 + " functionality of ";
Bharat saraswal2f11f652016-03-25 18:19:46 +053049
50 /**
51 * JavaDocs for builder interface class.
52 */
Bharat saraswal708abc02016-02-12 20:48:30 +053053 public static final String BUILDER_INTERFACE_JAVA_DOC = " * Builder for ";
Bharat saraswal2f11f652016-03-25 18:19:46 +053054
55 /**
Bharat saraswald72411a2016-04-19 01:00:16 +053056 * JavaDocs for enum class.
57 */
58 public static final String ENUM_CLASS_JAVADOC = " * Represents ENUM data of ";
59
60 /**
61 * JavaDocs for enum attribute.
62 */
63 public static final String ENUM_ATTRIBUTE_JAVADOC = " * Represents ";
64
65 /**
Bharat saraswal2f11f652016-03-25 18:19:46 +053066 * JavaDocs for package info class.
67 */
Bharat saraswald72411a2016-04-19 01:00:16 +053068 public static final String PACKAGE_INFO_JAVADOC = " * Implementation of YANG node ";
69
70 /**
71 * JavaDocs for package info class.
72 */
73 public static final String PACKAGE_INFO_JAVADOC_OF_CHILD = "'s children nodes";
Bharat saraswal2f11f652016-03-25 18:19:46 +053074
75 /**
76 * JavaDocs's first line.
77 */
Bharat saraswal708abc02016-02-12 20:48:30 +053078 public static final String JAVA_DOC_FIRST_LINE = "/**\n";
Bharat saraswal2f11f652016-03-25 18:19:46 +053079
80 /**
81 * JavaDocs's last line.
82 */
Bharat saraswal708abc02016-02-12 20:48:30 +053083 public static final String JAVA_DOC_END_LINE = " */\n";
Bharat saraswal2f11f652016-03-25 18:19:46 +053084
85 /**
86 * JavaDocs's param annotation.
87 */
Bharat saraswal708abc02016-02-12 20:48:30 +053088 public static final String JAVA_DOC_PARAM = " * @param ";
Bharat saraswal2f11f652016-03-25 18:19:46 +053089
90 /**
91 * JavaDocs's return annotation.
92 */
Bharat saraswal708abc02016-02-12 20:48:30 +053093 public static final String JAVA_DOC_RETURN = " * @return ";
Bharat saraswal2f11f652016-03-25 18:19:46 +053094
95 /**
96 * JavaDocs's throw annotation.
97 */
Bharat saraswal708abc02016-02-12 20:48:30 +053098 public static final String JAVA_DOC_THROWS = " * @throws ";
Bharat saraswal2f11f652016-03-25 18:19:46 +053099
100 /**
101 * JavaDocs's description for setter method.
102 */
Bharat saraswal708abc02016-02-12 20:48:30 +0530103 public static final String JAVA_DOC_SETTERS = " * Returns the builder object of ";
Bharat saraswal2f11f652016-03-25 18:19:46 +0530104
105 /**
106 * JavaDocs's description for OF method.
107 */
b.janani1fef2732016-03-04 12:29:05 +0530108 public static final String JAVA_DOC_OF = " * Returns the object of ";
Bharat saraswal2f11f652016-03-25 18:19:46 +0530109
110 /**
111 * JavaDocs's description for typedef' setter method.
112 */
b.janani1fef2732016-03-04 12:29:05 +0530113 public static final String JAVA_DOC_SETTERS_COMMON = " * Sets the value of ";
Bharat saraswal2f11f652016-03-25 18:19:46 +0530114
115 /**
116 * JavaDocs's description for getter method.
117 */
Bharat saraswal708abc02016-02-12 20:48:30 +0530118 public static final String JAVA_DOC_GETTERS = " * Returns the attribute ";
Bharat saraswal2f11f652016-03-25 18:19:46 +0530119
120 /**
Bharat saraswal2f11f652016-03-25 18:19:46 +0530121 * JavaDocs's description for constructor.
122 */
Bharat saraswal6ef0b762016-04-05 12:45:45 +0530123 public static final String JAVA_DOC_CONSTRUCTOR = " * Creates an instance of ";
Bharat saraswal2f11f652016-03-25 18:19:46 +0530124
125 /**
126 * JavaDocs's description for build method.
127 */
Bharat saraswal708abc02016-02-12 20:48:30 +0530128 public static final String JAVA_DOC_BUILD = " * Builds object of ";
Bharat saraswal2f11f652016-03-25 18:19:46 +0530129
130 /**
131 * JavaDocs's return statement for build method.
132 */
Bharat saraswal708abc02016-02-12 20:48:30 +0530133 public static final String JAVA_DOC_BUILD_RETURN = "object of ";
134
135 /**
Bharat saraswal2f11f652016-03-25 18:19:46 +0530136 * JavaDocs's statement for builder object.
137 */
138 public static final String BUILDER_OBJECT = "builder object of ";
139
140 /**
Gaurav Agrawal56527662016-04-20 15:49:17 +0530141 * JavaDocs's statement for rpc method.
142 */
143 public static final String JAVA_DOC_RPC = " * Service interface of ";
144
145 /**
146 * JavaDocs's statement for rpc's input string.
147 */
148 public static final String RPC_INPUT_STRING = "input of service interface ";
149
150 /**
151 * JavaDocs's statement for rpc's output string.
152 */
153 public static final String RPC_OUTPUT_STRING = "output of service interface ";
154
155 /**
Bharat saraswal2f11f652016-03-25 18:19:46 +0530156 * Static attribute for new line.
Bharat saraswal708abc02016-02-12 20:48:30 +0530157 */
158 public static final String NEW_LINE = "\n";
Bharat saraswal2f11f652016-03-25 18:19:46 +0530159
160 /**
161 * Static attribute for multiple new line.
162 */
Vinod Kumar S38046502016-03-23 15:30:27 +0530163 public static final String MULTIPLE_NEW_LINE = "\n\n";
Bharat saraswal2f11f652016-03-25 18:19:46 +0530164
165 /**
166 * Static attribute for empty line.
167 */
b.janani1fef2732016-03-04 12:29:05 +0530168 public static final String EMPTY_STRING = "";
Bharat saraswal2f11f652016-03-25 18:19:46 +0530169
170 /**
171 * Static attribute for new line with asterisk.
172 */
173 public static final String NEW_LINE_ASTERISK = " *\n";
174
175 /**
176 * Static attribute for period.
177 */
Bharat saraswal708abc02016-02-12 20:48:30 +0530178 public static final String PERIOD = ".";
Bharat saraswal2f11f652016-03-25 18:19:46 +0530179
180 /**
Gaurav Agrawal338735b2016-04-18 18:53:11 +0530181 * Static attribute for parse byte.
182 */
183 public static final String PARSE_BYTE = "parseByte";
184
185 /**
186 * Static attribute for parse short.
187 */
188 public static final String PARSE_SHORT = "parseShort";
189
190 /**
191 * Static attribute for parse int.
192 */
193 public static final String PARSE_INT = "parseInt";
194
195 /**
196 * Static attribute for parse long.
197 */
198 public static final String PARSE_LONG = "parseLong";
199
200 /**
201 * Static attribute for omit null value.
202 */
203 public static final String OMIT_NULL_VALUE_STRING = "omitNullValues()";
204
205 /**
Bharat saraswal2f11f652016-03-25 18:19:46 +0530206 * Static attribute for colan.
207 */
Bharat saraswal708abc02016-02-12 20:48:30 +0530208 public static final String COLAN = ":";
Bharat saraswal2f11f652016-03-25 18:19:46 +0530209
210 /**
211 * Static attribute for underscore.
212 */
b.janani1fef2732016-03-04 12:29:05 +0530213 public static final String UNDER_SCORE = "_";
Bharat saraswal2f11f652016-03-25 18:19:46 +0530214
215 /**
216 * Static attribute for semi-colan.
217 */
Bharat saraswal708abc02016-02-12 20:48:30 +0530218 public static final String SEMI_COLAN = ";";
Bharat saraswal2f11f652016-03-25 18:19:46 +0530219
220 /**
221 * Static attribute for hyphen.
222 */
Bharat saraswal708abc02016-02-12 20:48:30 +0530223 public static final String HYPHEN = "-";
Bharat saraswal2f11f652016-03-25 18:19:46 +0530224
225 /**
226 * Static attribute for space.
227 */
Bharat saraswal708abc02016-02-12 20:48:30 +0530228 public static final String SPACE = " ";
Bharat saraswal2f11f652016-03-25 18:19:46 +0530229
230 /**
Gaurav Agrawal338735b2016-04-18 18:53:11 +0530231 * Static attribute for input string.
Bharat saraswal2f11f652016-03-25 18:19:46 +0530232 */
Gaurav Agrawal338735b2016-04-18 18:53:11 +0530233 public static final String INPUT = "input";
Bharat saraswal2f11f652016-03-25 18:19:46 +0530234
235 /**
Gaurav Agrawal56527662016-04-20 15:49:17 +0530236 * Static attribute for output variable of rpc.
237 */
238 public static final String RPC_INPUT_VAR_NAME = "inputVar";
239
240 /**
Bharat saraswal2f11f652016-03-25 18:19:46 +0530241 * Static attribute for new line.
242 */
Bharat saraswal708abc02016-02-12 20:48:30 +0530243 public static final String EQUAL = "=";
Bharat saraswal2f11f652016-03-25 18:19:46 +0530244
245 /**
246 * Static attribute for slash syntax.
247 */
Vinod Kumar S38046502016-03-23 15:30:27 +0530248 public static final String SLASH = File.separator;
Bharat saraswal2f11f652016-03-25 18:19:46 +0530249
250 /**
251 * Static attribute for add syntax.
252 */
Bharat saraswal708abc02016-02-12 20:48:30 +0530253 public static final String ADD = "+";
Bharat saraswal2f11f652016-03-25 18:19:46 +0530254
255 /**
256 * Static attribute for asterisk.
257 */
Bharat saraswal708abc02016-02-12 20:48:30 +0530258 public static final String ASTERISK = "*";
Bharat saraswal2f11f652016-03-25 18:19:46 +0530259
260 /**
261 * Static attribute for at.
262 */
Bharat saraswal708abc02016-02-12 20:48:30 +0530263 public static final String AT = "@";
Bharat saraswal2f11f652016-03-25 18:19:46 +0530264
265 /**
266 * Static attribute for quotes.
267 */
b.janani1fef2732016-03-04 12:29:05 +0530268 public static final String QUOTES = "\"";
Bharat saraswal2f11f652016-03-25 18:19:46 +0530269
270 /**
271 * Static attribute for ampersand.
272 */
b.janani1fef2732016-03-04 12:29:05 +0530273 public static final String AND = "&";
Bharat saraswal2f11f652016-03-25 18:19:46 +0530274
275 /**
276 * Static attribute for comma.
277 */
b.janani1fef2732016-03-04 12:29:05 +0530278 public static final String COMMA = ",";
Bharat saraswal2f11f652016-03-25 18:19:46 +0530279
280 /**
281 * Static attribute for add syntax.
282 */
b.janani1fef2732016-03-04 12:29:05 +0530283 public static final String ADD_STRING = "add";
Bharat saraswal2f11f652016-03-25 18:19:46 +0530284
285 /**
Gaurav Agrawal338735b2016-04-18 18:53:11 +0530286 * Static attribute for from syntax.
287 */
288 public static final String FROM_STRING_METHOD_NAME = "fromString";
289
290 /**
Bharat saraswal2f11f652016-03-25 18:19:46 +0530291 * Static attribute for check not null syntax.
292 */
b.janani1fef2732016-03-04 12:29:05 +0530293 public static final String CHECK_NOT_NULL_STRING = "checkNotNull";
Bharat saraswal2f11f652016-03-25 18:19:46 +0530294
295 /**
296 * Static attribute for hash code syntax.
297 */
b.janani1fef2732016-03-04 12:29:05 +0530298 public static final String HASH_CODE_STRING = "hashCode";
Bharat saraswal2f11f652016-03-25 18:19:46 +0530299
300 /**
301 * Static attribute for equals syntax.
302 */
b.janani1fef2732016-03-04 12:29:05 +0530303 public static final String EQUALS_STRING = "equals";
Bharat saraswal2f11f652016-03-25 18:19:46 +0530304
305 /**
306 * Static attribute for object.
307 */
b.janani1fef2732016-03-04 12:29:05 +0530308 public static final String OBJECT_STRING = "Object";
Bharat saraswal2f11f652016-03-25 18:19:46 +0530309
310 /**
311 * Static attribute for instance of syntax.
312 */
b.janani1fef2732016-03-04 12:29:05 +0530313 public static final String INSTANCE_OF = " instanceof ";
314
Bharat saraswal2f11f652016-03-25 18:19:46 +0530315 /**
316 * Static attribute for value syntax.
317 */
b.janani1fef2732016-03-04 12:29:05 +0530318 public static final String VALUE = "value";
Bharat saraswal2f11f652016-03-25 18:19:46 +0530319
320 /**
Bharat saraswald72411a2016-04-19 01:00:16 +0530321 * Static attribute for enumValue syntax.
322 */
323 public static final String ENUM_VALUE = "enumValue";
324
325 /**
Bharat saraswal2f11f652016-03-25 18:19:46 +0530326 * Static attribute for suffix s.
327 */
Bharat saraswale2d51d62016-03-23 19:40:35 +0530328 public static final String SUFFIX_S = "s";
b.janani1fef2732016-03-04 12:29:05 +0530329
Bharat saraswal2f11f652016-03-25 18:19:46 +0530330 /**
331 * Static attribute for if.
332 */
b.janani1fef2732016-03-04 12:29:05 +0530333 public static final String IF = "if";
Bharat saraswal2f11f652016-03-25 18:19:46 +0530334
335 /**
336 * Static attribute for for.
337 */
b.janani1fef2732016-03-04 12:29:05 +0530338 public static final String FOR = "for";
Bharat saraswal2f11f652016-03-25 18:19:46 +0530339
340 /**
341 * Static attribute for while.
342 */
b.janani1fef2732016-03-04 12:29:05 +0530343 public static final String WHILE = "while";
Bharat saraswal2f11f652016-03-25 18:19:46 +0530344
345 /**
346 * Static attribute for of.
347 */
b.janani1fef2732016-03-04 12:29:05 +0530348 public static final String OF = "of";
Bharat saraswal2f11f652016-03-25 18:19:46 +0530349
350 /**
351 * Static attribute for other.
352 */
Vinod Kumar S38046502016-03-23 15:30:27 +0530353 public static final String OTHER = "other";
Bharat saraswal2f11f652016-03-25 18:19:46 +0530354
355 /**
356 * Static attribute for obj syntax.
357 */
Vinod Kumar S38046502016-03-23 15:30:27 +0530358 public static final String OBJ = "obj";
Bharat saraswal2f11f652016-03-25 18:19:46 +0530359
360 /**
361 * Static attribute for hash syntax.
362 */
Vinod Kumar S38046502016-03-23 15:30:27 +0530363 public static final String HASH = "hash";
Bharat saraswal2f11f652016-03-25 18:19:46 +0530364
365 /**
366 * Static attribute for to syntax.
367 */
Vinod Kumar S38046502016-03-23 15:30:27 +0530368 public static final String TO = "to";
b.janani1fef2732016-03-04 12:29:05 +0530369
Bharat saraswal2f11f652016-03-25 18:19:46 +0530370 /**
371 * Static attribute for true syntax.
372 */
b.janani1fef2732016-03-04 12:29:05 +0530373 public static final String TRUE = "true";
Bharat saraswal2f11f652016-03-25 18:19:46 +0530374
375 /**
376 * Static attribute for false syntax.
377 */
b.janani1fef2732016-03-04 12:29:05 +0530378 public static final String FALSE = "false";
Bharat saraswal2f11f652016-03-25 18:19:46 +0530379
380 /**
381 * Static attribute for org.
382 */
Vinod Kumar S38046502016-03-23 15:30:27 +0530383 public static final String ORG = "org";
Bharat saraswal2f11f652016-03-25 18:19:46 +0530384
385 /**
386 * Static attribute for temp.
387 */
Vinod Kumar S38046502016-03-23 15:30:27 +0530388 public static final String TEMP = "temp";
Bharat saraswal2f11f652016-03-25 18:19:46 +0530389
390 /**
391 * Static attribute for YANG file directory.
392 */
Vinod Kumar S38046502016-03-23 15:30:27 +0530393 public static final String YANG_RESOURCES = "yang/resources";
Bharat saraswal708abc02016-02-12 20:48:30 +0530394
395 /**
Bharat saraswal2f11f652016-03-25 18:19:46 +0530396 * Static attribute for diamond close bracket syntax.
Bharat saraswal708abc02016-02-12 20:48:30 +0530397 */
398 public static final String DIAMOND_OPEN_BRACKET = "<";
Bharat saraswal2f11f652016-03-25 18:19:46 +0530399
400 /**
401 * Static attribute for diamond close bracket syntax.
402 */
Bharat saraswal708abc02016-02-12 20:48:30 +0530403 public static final String DIAMOND_CLOSE_BRACKET = ">";
Bharat saraswal2f11f652016-03-25 18:19:46 +0530404
405 /**
Gaurav Agrawal338735b2016-04-18 18:53:11 +0530406 * Static attribute for exception syntax.
Bharat saraswal2f11f652016-03-25 18:19:46 +0530407 */
Gaurav Agrawal338735b2016-04-18 18:53:11 +0530408 public static final String EXCEPTION = "Exception";
Bharat saraswal2f11f652016-03-25 18:19:46 +0530409
410 /**
Gaurav Agrawal338735b2016-04-18 18:53:11 +0530411 * Static attribute for exception variable syntax.
Bharat saraswal2f11f652016-03-25 18:19:46 +0530412 */
Gaurav Agrawal338735b2016-04-18 18:53:11 +0530413 public static final String EXCEPTION_VAR = "e";
Bharat saraswal2f11f652016-03-25 18:19:46 +0530414
415 /**
416 * Static attribute for open parenthesis syntax.
417 */
Bharat saraswal708abc02016-02-12 20:48:30 +0530418 public static final String OPEN_PARENTHESIS = "(";
Bharat saraswal2f11f652016-03-25 18:19:46 +0530419
420 /**
Gaurav Agrawal338735b2016-04-18 18:53:11 +0530421 * Static attribute for clear syntax.
422 */
423 public static final String CLEAR = "clear";
424
425 /**
426 * Static attribute for temp val syntax.
427 */
428 public static final String TMP_VAL = "tmpVal";
429
430 /**
431 * From string parameter name.
432 */
433 public static final String FROM_STRING_PARAM_NAME = "valInString";
434
435 /**
Bharat saraswal2f11f652016-03-25 18:19:46 +0530436 * Static attribute for close parenthesis syntax.
437 */
Bharat saraswal708abc02016-02-12 20:48:30 +0530438 public static final String CLOSE_PARENTHESIS = ")";
Bharat saraswal2f11f652016-03-25 18:19:46 +0530439
440 /**
441 * Static attribute for open curly bracket syntax.
442 */
Bharat saraswal708abc02016-02-12 20:48:30 +0530443 public static final String OPEN_CURLY_BRACKET = "{";
Bharat saraswal2f11f652016-03-25 18:19:46 +0530444
445 /**
446 * Static attribute for close curly bracket syntax.
447 */
Bharat saraswal708abc02016-02-12 20:48:30 +0530448 public static final String CLOSE_CURLY_BRACKET = "}";
449
450 /**
Bharat saraswal2f11f652016-03-25 18:19:46 +0530451 * Static attribute for getter method prefix.
Bharat saraswal708abc02016-02-12 20:48:30 +0530452 */
453 public static final String GET_METHOD_PREFIX = "get";
Bharat saraswal2f11f652016-03-25 18:19:46 +0530454
455 /**
456 * Static attribute for setter method prefix.
457 */
Bharat saraswal708abc02016-02-12 20:48:30 +0530458 public static final String SET_METHOD_PREFIX = "set";
459
460 /**
Bharat saraswal2f11f652016-03-25 18:19:46 +0530461 * Static attribute for four space indentation.
Bharat saraswal708abc02016-02-12 20:48:30 +0530462 */
463 public static final String FOUR_SPACE_INDENTATION = " ";
Bharat saraswal2f11f652016-03-25 18:19:46 +0530464
465 /**
Gaurav Agrawal338735b2016-04-18 18:53:11 +0530466 * Static attribute for not syntax.
467 */
468 public static final String NOT = "!";
469
470 /**
471 * Static attribute for try syntax.
472 */
473 public static final String TRY = "try";
474
475 /**
476 * Static attribute for catch syntax.
477 */
478 public static final String CATCH = "catch";
479
480 /**
Bharat saraswal2f11f652016-03-25 18:19:46 +0530481 * Static attribute for eight space indentation.
482 */
Bharat saraswal708abc02016-02-12 20:48:30 +0530483 public static final String EIGHT_SPACE_INDENTATION = FOUR_SPACE_INDENTATION + FOUR_SPACE_INDENTATION;
Bharat saraswal2f11f652016-03-25 18:19:46 +0530484
485 /**
486 * Static attribute for twelve space indentation.
487 */
Bharat saraswal708abc02016-02-12 20:48:30 +0530488 public static final String TWELVE_SPACE_INDENTATION = FOUR_SPACE_INDENTATION + EIGHT_SPACE_INDENTATION;
Bharat saraswal2f11f652016-03-25 18:19:46 +0530489
490 /**
491 * Static attribute for sixteen space indentation.
492 */
Bharat saraswal708abc02016-02-12 20:48:30 +0530493 public static final String SIXTEEN_SPACE_INDENTATION = EIGHT_SPACE_INDENTATION + EIGHT_SPACE_INDENTATION;
494
495 /**
Bharat saraswal2f11f652016-03-25 18:19:46 +0530496 * Static attribute for generated code path.
Bharat saraswal708abc02016-02-12 20:48:30 +0530497 */
Bharat saraswal8f2a6c52016-03-09 18:34:56 +0530498 public static final String YANG_GEN_DIR = "src/main/java/";
Bharat saraswal2f11f652016-03-25 18:19:46 +0530499
500 /**
501 * Static attribute for base package.
502 */
Bharat saraswal708abc02016-02-12 20:48:30 +0530503 public static final String DEFAULT_BASE_PKG = "org.onosproject.yang.gen";
Bharat saraswal2f11f652016-03-25 18:19:46 +0530504
505 /**
506 * Static attribute for YANG date prefix.
507 */
Bharat saraswal708abc02016-02-12 20:48:30 +0530508 public static final String REVISION_PREFIX = "rev";
Bharat saraswal2f11f652016-03-25 18:19:46 +0530509
510 /**
janani bde4ffab2016-04-15 16:18:30 +0530511 * Static attribute for YANG automatic prefix for identifiers with keywords and beginning with digits.
512 */
513 public static final String YANG_AUTO_PREFIX = "yangAutoPrefix";
514
515 /**
Bharat saraswal2f11f652016-03-25 18:19:46 +0530516 * Static attribute for YANG version perifx.
517 */
Bharat saraswal708abc02016-02-12 20:48:30 +0530518 public static final String VERSION_PREFIX = "v";
519
520 /**
Bharat saraswal2f11f652016-03-25 18:19:46 +0530521 * Static attribute for private modifier.
Bharat saraswal708abc02016-02-12 20:48:30 +0530522 */
523 public static final String PRIVATE = "private";
Bharat saraswal708abc02016-02-12 20:48:30 +0530524
525 /**
Bharat saraswal2f11f652016-03-25 18:19:46 +0530526 * Static attribute for public modifier.
Bharat saraswal708abc02016-02-12 20:48:30 +0530527 */
Bharat saraswal2f11f652016-03-25 18:19:46 +0530528 public static final String PUBLIC = "public";
529
530 /**
531 * Static attribute for protected modifier.
532 */
533 public static final String PROTECTED = "protected";
534
Vinod Kumar Sc4216002016-03-03 19:55:30 +0530535 /**
536 * Void java type.
537 */
Bharat saraswal708abc02016-02-12 20:48:30 +0530538 public static final String VOID = "void";
Vinod Kumar Sc4216002016-03-03 19:55:30 +0530539
540 /**
541 * String built in java type.
542 */
Bharat saraswale2d51d62016-03-23 19:40:35 +0530543 public static final String STRING_DATA_TYPE = "String";
Bharat saraswalcc1cdab2016-04-16 02:28:25 +0530544
Vinod Kumar Sc4216002016-03-03 19:55:30 +0530545 /**
Bharat saraswalcc1cdab2016-04-16 02:28:25 +0530546 * Java.lang.* packages.
Vinod Kumar Sc4216002016-03-03 19:55:30 +0530547 */
548 public static final String JAVA_LANG = "java.lang";
549
550 /**
Bharat saraswalcc1cdab2016-04-16 02:28:25 +0530551 * Java.math.* packages.
552 */
553 public static final String JAVA_MATH = "java.math";
554
555 /**
556 * Boolean built in java type.
Vinod Kumar Sc4216002016-03-03 19:55:30 +0530557 */
Bharat saraswale2d51d62016-03-23 19:40:35 +0530558 public static final String BOOLEAN_DATA_TYPE = "boolean";
Vinod Kumar Sc4216002016-03-03 19:55:30 +0530559
560 /**
Bharat saraswalcc1cdab2016-04-16 02:28:25 +0530561 * BigInteger built in java type.
562 */
563 public static final String BIG_INTEGER = "BigInteger";
564
565 /**
566 * Byte java built in type.
Vinod Kumar Sc4216002016-03-03 19:55:30 +0530567 */
Bharat saraswal708abc02016-02-12 20:48:30 +0530568 public static final String BYTE = "byte";
Vinod Kumar Sc4216002016-03-03 19:55:30 +0530569
570 /**
Bharat saraswalcc1cdab2016-04-16 02:28:25 +0530571 * Short java built in type.
Vinod Kumar Sc4216002016-03-03 19:55:30 +0530572 */
573 public static final String SHORT = "short";
574
575 /**
Bharat saraswalcc1cdab2016-04-16 02:28:25 +0530576 * Int java built in type.
Vinod Kumar Sc4216002016-03-03 19:55:30 +0530577 */
578 public static final String INT = "int";
579
580 /**
Bharat saraswalcc1cdab2016-04-16 02:28:25 +0530581 * Long java built in type.
Vinod Kumar Sc4216002016-03-03 19:55:30 +0530582 */
583 public static final String LONG = "long";
584
585 /**
Bharat saraswalcc1cdab2016-04-16 02:28:25 +0530586 * Float java built in type.
Vinod Kumar Sc4216002016-03-03 19:55:30 +0530587 */
588 public static final String FLOAT = "float";
589
590 /**
Bharat saraswalcc1cdab2016-04-16 02:28:25 +0530591 * Double java built in type.
Vinod Kumar Sc4216002016-03-03 19:55:30 +0530592 */
Bharat saraswal708abc02016-02-12 20:48:30 +0530593 public static final String DOUBLE = "double";
594
595 /**
Bharat saraswalcc1cdab2016-04-16 02:28:25 +0530596 * Boolean built in java wrapper type.
Vinod Kumar Sc4216002016-03-03 19:55:30 +0530597 */
598 public static final String BOOLEAN_WRAPPER = "Boolean";
599
600 /**
Bharat saraswalcc1cdab2016-04-16 02:28:25 +0530601 * Byte java built in wrapper type.
Vinod Kumar Sc4216002016-03-03 19:55:30 +0530602 */
603 public static final String BYTE_WRAPPER = "Byte";
604
605 /**
Bharat saraswalcc1cdab2016-04-16 02:28:25 +0530606 * Short java built in wrapper type.
Vinod Kumar Sc4216002016-03-03 19:55:30 +0530607 */
608 public static final String SHORT_WRAPPER = "Short";
609
610 /**
611 * Integer java built in wrapper type.
612 */
613 public static final String INTEGER_WRAPPER = "Integer";
614
615 /**
Bharat saraswalcc1cdab2016-04-16 02:28:25 +0530616 * Long java built in wrapper type.
Vinod Kumar Sc4216002016-03-03 19:55:30 +0530617 */
618 public static final String LONG_WRAPPER = "Long";
619
620 /**
Gaurav Agrawal338735b2016-04-18 18:53:11 +0530621 * YangUint64 java built in wrapper type.
Vinod Kumar Sc4216002016-03-03 19:55:30 +0530622 */
Gaurav Agrawal338735b2016-04-18 18:53:11 +0530623 public static final String YANG_UINT64 = "YangUint64";
Vinod Kumar Sc4216002016-03-03 19:55:30 +0530624
625 /**
Bharat saraswale2d51d62016-03-23 19:40:35 +0530626 * List of keywords in java, this is used for checking if the input does not contain these keywords.
b.janani1fef2732016-03-04 12:29:05 +0530627 */
Bharat saraswal2f11f652016-03-25 18:19:46 +0530628 public static final List<String> JAVA_KEY_WORDS = Arrays.asList(
629 "abstract", "assert", "boolean", "break", "byte", "case", "catch", "char", "class", "const", "continue",
630 "default", "do", "double", "else", "extends", "false", "final", "finally", "float", "for", "goto", "if",
631 "implements", "import", "instanceof", "int", "interface", "long", "native", "new", "null", "package",
632 "private", "protected", "public", "return", "short", "static", "strictfp", "super", "switch",
633 "synchronized", "this", "throw", "throws", "transient", "true", "try", "void", "volatile", "while");
b.janani1fef2732016-03-04 12:29:05 +0530634
635 /**
janani bde4ffab2016-04-15 16:18:30 +0530636 * Static attribute for regex for all the special characters.
b.janani1fef2732016-03-04 12:29:05 +0530637 */
janani bde4ffab2016-04-15 16:18:30 +0530638 public static final String REGEX_WITH_ALL_SPECIAL_CHAR = "\\p{Punct}+";
639
640 /**
641 * Static attribute for regex for three special characters used in identifier.
642 */
643 public static final String REGEX_FOR_IDENTIFIER_SPECIAL_CHAR = "[. _ -]+";
644
645 /**
646 * Static attribute for regex for period.
647 */
648 public static final String REGEX_FOR_PERIOD = "[.]";
649
650 /**
651 * Static attribute for regex for underscore.
652 */
653 public static final String REGEX_FOR_UNDERSCORE = "[_]";
654
655 /**
656 * Static attribute for regex for hyphen.
657 */
658 public static final String REGEX_FOR_HYPHEN = "[-]";
Bharat saraswal2f11f652016-03-25 18:19:46 +0530659
660 /**
661 * Static attribute for regex for digits.
662 */
b.janani1fef2732016-03-04 12:29:05 +0530663 public static final String REGEX_FOR_FIRST_DIGIT = "\\d.*";
664
665 /**
janani bde4ffab2016-04-15 16:18:30 +0530666 * Static attribute for regex for single letter.
667 */
668 public static final String REGEX_FOR_SINGLE_LETTER = "[a-zA-Z]";
669
670 /**
671 * Static attribute for regex for digits with single letter.
672 */
673 public static final String REGEX_FOR_DIGITS_WITH_SINGLE_LETTER = "[0-9]+[a-zA-Z]";
674
675 /**
Bharat saraswal2f11f652016-03-25 18:19:46 +0530676 * Static attribute for class syntax.
Bharat saraswal708abc02016-02-12 20:48:30 +0530677 */
678 public static final String CLASS = "class";
Bharat saraswal708abc02016-02-12 20:48:30 +0530679
680 /**
Bharat saraswal2f11f652016-03-25 18:19:46 +0530681 * Static attribute for builder syntax.
682 */
683 public static final String BUILDER = "Builder";
684
685 /**
686 * Static attribute for interface syntax.
687 */
688 public static final String INTERFACE = "interface";
689
690 /**
691 * Static attribute for enum syntax.
692 */
693 public static final String ENUM = "enum";
694
695 /**
696 * Static attribute for static syntax.
697 */
698 public static final String STATIC = "static";
699
700 /**
701 * Static attribute for final syntax.
702 */
703 public static final String FINAL = "final";
704
705 /**
706 * Static attribute for package syntax.
707 */
708 public static final String PACKAGE = "package";
709
710 /**
711 * Static attribute for import syntax.
712 */
713 public static final String IMPORT = "import ";
714
715 /**
716 * Static attribute for null syntax.
717 */
718 public static final String NULL = "null";
719
720 /**
721 * Static attribute for return syntax.
722 */
723 public static final String RETURN = "return";
724
725 /**
726 * Static attribute for java new syntax.
727 */
728 public static final String NEW = "new";
729
730 /**
731 * Static attribute for this syntax.
732 */
733 public static final String THIS = "this";
734
735 /**
736 * Static attribute for implements syntax.
737 */
738 public static final String IMPLEMENTS = "implements";
739
740 /**
741 * Static attribute for extends syntax.
742 */
743 public static final String EXTEND = "extends";
744
745 /**
Gaurav Agrawal56527662016-04-20 15:49:17 +0530746 * Static attribute for service interface suffix syntax.
747 */
748 public static final String SERVICE_METHOD_STRING = "Service";
749
750 /**
Bharat saraswal2f11f652016-03-25 18:19:46 +0530751 * Static attribute for impl syntax.
752 */
753 public static final String IMPL = "Impl";
754
755 /**
756 * Static attribute for build method syntax.
757 */
758 public static final String BUILD = "build";
759
760 /**
761 * Static attribute for object.
762 */
763 public static final String OBJECT = "Object";
764
765 /**
766 * Static attribute for override annotation.
767 */
768 public static final String OVERRIDE = "@Override";
769
770 /**
771 * Static attribute for new line.
Bharat saraswal708abc02016-02-12 20:48:30 +0530772 */
b.janani1fef2732016-03-04 12:29:05 +0530773 public static final String COLLECTION_IMPORTS = "java.util";
Bharat saraswal2f11f652016-03-25 18:19:46 +0530774
775 /**
776 * Static attribute for more object import package.
777 */
Vinod Kumar S38046502016-03-23 15:30:27 +0530778 public static final String GOOGLE_MORE_OBJECT_IMPORT_PKG = "com.google.common.base";
Bharat saraswal2f11f652016-03-25 18:19:46 +0530779
780 /**
781 * Static attribute for more object import class.
782 */
Vinod Kumar S38046502016-03-23 15:30:27 +0530783 public static final String GOOGLE_MORE_OBJECT_IMPORT_CLASS = "MoreObjects;\n";
Bharat saraswal2f11f652016-03-25 18:19:46 +0530784
785 /**
786 * Static attribute for to string method.
787 */
Vinod Kumar S38046502016-03-23 15:30:27 +0530788 public static final String GOOGLE_MORE_OBJECT_METHOD_STRING = " MoreObjects.toStringHelper(getClass())";
Bharat saraswal2f11f652016-03-25 18:19:46 +0530789
790 /**
791 * Static attribute for java utilities import package.
792 */
Vinod Kumar S38046502016-03-23 15:30:27 +0530793 public static final String JAVA_UTIL_OBJECTS_IMPORT_PKG = "java.util";
Bharat saraswal2f11f652016-03-25 18:19:46 +0530794
795 /**
796 * Static attribute for java utilities objects import class.
797 */
Vinod Kumar S38046502016-03-23 15:30:27 +0530798 public static final String JAVA_UTIL_OBJECTS_IMPORT_CLASS = "Objects;\n";
Bharat saraswal2f11f652016-03-25 18:19:46 +0530799
800 /**
Bharat saraswalcc1cdab2016-04-16 02:28:25 +0530801 * Static attribute for HasAugmentation class import package.
802 */
803 public static final String HAS_AUGMENTATION_CLASS_IMPORT_PKG = "org.onosproject.yangutils.translator.tojava";
804
805 /**
806 * Static attribute for HasAugmentation class import class.
807 */
808 public static final String HAS_AUGMENTATION_CLASS_IMPORT_CLASS = "HasAugmentation;\n";
809
810 /**
811 * Static attribute for AugmentedInfo class import package.
812 */
813 public static final String AUGMENTED_INFO_CLASS_IMPORT_PKG = "org.onosproject.yangutils.translator.tojava";
814
815 /**
816 * Static attribute for AugmentedInfo class import class.
817 */
818 public static final String AUGMENTED_INFO_CLASS_IMPORT_CLASS = "AugmentedInfo;\n";
819
820 /**
821 * Static attribute for augmentation class.
822 */
823 public static final String AUGMENTATION = "Augmentation";
824
825 /**
826 * Static attribute for HasAugmentation class.
827 */
828 public static final String HAS_AUGMENTATION = "HasAugmentation";
829
830 /**
831 * Static attribute for AugmentedInfo class.
832 */
833 public static final String AUGMENTED_INFO = "AugmentedInfo";
834
835 /**
Bharat saraswal2f11f652016-03-25 18:19:46 +0530836 * Static attribute for list.
837 */
Bharat saraswal708abc02016-02-12 20:48:30 +0530838 public static final String LIST = "List";
Bharat saraswal2f11f652016-03-25 18:19:46 +0530839
840 /**
Bharat saraswal2f11f652016-03-25 18:19:46 +0530841 * Static attribute for array list.
842 */
Bharat saraswal708abc02016-02-12 20:48:30 +0530843 public static final String ARRAY_LIST = "ArrayList";
Bharat saraswal708abc02016-02-12 20:48:30 +0530844}