Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 1 | /* |
Brian O'Connor | 0f7908b | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2016-present Open Networking Laboratory |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 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.translator.tojava; |
| 17 | |
Bharat saraswal | 84366c5 | 2016-03-23 19:40:35 +0530 | [diff] [blame] | 18 | import java.util.ArrayList; |
| 19 | import java.util.List; |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 20 | import java.util.SortedSet; |
| 21 | import java.util.TreeSet; |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 22 | |
Bharat saraswal | 9fab16b | 2016-09-23 23:27:24 +0530 | [diff] [blame^] | 23 | import static java.util.Collections.sort; |
| 24 | import static java.util.Collections.unmodifiableSortedSet; |
| 25 | import static org.onosproject.yangutils.translator.tojava.utils.StringGenerator.getImportString; |
Bharat saraswal | 715d3fc | 2016-05-17 19:59:16 +0530 | [diff] [blame] | 26 | import static org.onosproject.yangutils.utils.UtilConstants.ABSTRACT_EVENT; |
Bharat saraswal | 64e7e23 | 2016-07-14 23:33:55 +0530 | [diff] [blame] | 27 | import static org.onosproject.yangutils.utils.UtilConstants.BIG_INTEGER; |
Shankara-Huawei | b756477 | 2016-08-02 18:13:13 +0530 | [diff] [blame] | 28 | import static org.onosproject.yangutils.utils.UtilConstants.BITSET; |
Bharat saraswal | 84366c5 | 2016-03-23 19:40:35 +0530 | [diff] [blame] | 29 | import static org.onosproject.yangutils.utils.UtilConstants.COLLECTION_IMPORTS; |
| 30 | import static org.onosproject.yangutils.utils.UtilConstants.EMPTY_STRING; |
Bharat saraswal | 715d3fc | 2016-05-17 19:59:16 +0530 | [diff] [blame] | 31 | import static org.onosproject.yangutils.utils.UtilConstants.EVENT_LISTENER; |
Bharat saraswal | 84366c5 | 2016-03-23 19:40:35 +0530 | [diff] [blame] | 32 | import static org.onosproject.yangutils.utils.UtilConstants.GOOGLE_MORE_OBJECT_IMPORT_CLASS; |
| 33 | import static org.onosproject.yangutils.utils.UtilConstants.GOOGLE_MORE_OBJECT_IMPORT_PKG; |
Bharat saraswal | af413b8 | 2016-07-14 15:18:20 +0530 | [diff] [blame] | 34 | import static org.onosproject.yangutils.utils.UtilConstants.HASH_MAP; |
Bharat saraswal | 84366c5 | 2016-03-23 19:40:35 +0530 | [diff] [blame] | 35 | import static org.onosproject.yangutils.utils.UtilConstants.JAVA_LANG; |
Bharat saraswal | 64e7e23 | 2016-07-14 23:33:55 +0530 | [diff] [blame] | 36 | import static org.onosproject.yangutils.utils.UtilConstants.JAVA_MATH; |
Bharat saraswal | 84366c5 | 2016-03-23 19:40:35 +0530 | [diff] [blame] | 37 | import static org.onosproject.yangutils.utils.UtilConstants.JAVA_UTIL_OBJECTS_IMPORT_CLASS; |
| 38 | import static org.onosproject.yangutils.utils.UtilConstants.JAVA_UTIL_OBJECTS_IMPORT_PKG; |
| 39 | import static org.onosproject.yangutils.utils.UtilConstants.LIST; |
Bharat saraswal | 4aaab4d | 2016-05-17 14:19:38 +0530 | [diff] [blame] | 40 | import static org.onosproject.yangutils.utils.UtilConstants.LISTENER_SERVICE; |
Bharat saraswal | af413b8 | 2016-07-14 15:18:20 +0530 | [diff] [blame] | 41 | import static org.onosproject.yangutils.utils.UtilConstants.MAP; |
Bharat saraswal | 715d3fc | 2016-05-17 19:59:16 +0530 | [diff] [blame] | 42 | import static org.onosproject.yangutils.utils.UtilConstants.ONOS_EVENT_PKG; |
Vidyashree Rama | b367047 | 2016-08-06 15:49:56 +0530 | [diff] [blame] | 43 | import static org.onosproject.yangutils.utils.UtilConstants.QUEUE; |
Vidyashree Rama | b367047 | 2016-08-06 15:49:56 +0530 | [diff] [blame] | 44 | import static org.onosproject.yangutils.utils.UtilConstants.SET; |
VinodKumarS-Huawei | d81eccb | 2016-06-01 14:30:22 +0530 | [diff] [blame] | 45 | |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 46 | /** |
Bharat saraswal | 63f26fb | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 47 | * Represents that generated Java file can contain imports. |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 48 | */ |
| 49 | public class JavaImportData { |
| 50 | |
| 51 | /** |
| 52 | * Flag to denote if any list in imported. |
| 53 | */ |
| 54 | private boolean isListToImport; |
| 55 | |
| 56 | /** |
Vidyashree Rama | b367047 | 2016-08-06 15:49:56 +0530 | [diff] [blame] | 57 | * Flag to denote if any queue is imported due to compiler annotation. |
| 58 | */ |
| 59 | private boolean isQueueToImport; |
| 60 | |
| 61 | /** |
| 62 | * Flag to denote if any set is imported due to compiler annotation. |
| 63 | */ |
| 64 | private boolean isSetToImport; |
| 65 | |
| 66 | /** |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 67 | * Sorted set of import info, to be used to maintain the set of classes to |
| 68 | * be imported in the generated class. |
| 69 | */ |
Bharat saraswal | 9fab16b | 2016-09-23 23:27:24 +0530 | [diff] [blame^] | 70 | private final SortedSet<JavaQualifiedTypeInfoTranslator> importSet; |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 71 | |
| 72 | /** |
Bharat saraswal | 63f26fb | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 73 | * Creates java import data object. |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 74 | */ |
| 75 | public JavaImportData() { |
Bharat saraswal | 9fab16b | 2016-09-23 23:27:24 +0530 | [diff] [blame^] | 76 | importSet = new TreeSet<>(); |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 77 | } |
| 78 | |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 79 | |
| 80 | /** |
Bharat saraswal | 63f26fb | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 81 | * Sets the status of importing list. |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 82 | * |
Vidyashree Rama | 02f115f | 2016-04-18 12:29:39 +0530 | [diff] [blame] | 83 | * @param isList status to mention list is bing imported |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 84 | */ |
Shankara-Huawei | b756477 | 2016-08-02 18:13:13 +0530 | [diff] [blame] | 85 | void setIfListImported(boolean isList) { |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 86 | isListToImport = isList; |
| 87 | } |
| 88 | |
Vidyashree Rama | b367047 | 2016-08-06 15:49:56 +0530 | [diff] [blame] | 89 | |
| 90 | /** |
| 91 | * Sets the status of the queue to be imported due to compiler annotations. |
| 92 | * |
| 93 | * @param queueToImport status of queue to import |
| 94 | */ |
Bharat saraswal | 9fab16b | 2016-09-23 23:27:24 +0530 | [diff] [blame^] | 95 | void setQueueToImport(boolean queueToImport) { |
Vidyashree Rama | b367047 | 2016-08-06 15:49:56 +0530 | [diff] [blame] | 96 | isQueueToImport = queueToImport; |
| 97 | } |
| 98 | |
| 99 | /** |
| 100 | * Sets the status of the set to be imported due to compiler annotations. |
| 101 | * |
| 102 | * @param setToImport status of set to import |
| 103 | */ |
Bharat saraswal | 9fab16b | 2016-09-23 23:27:24 +0530 | [diff] [blame^] | 104 | void setSetToImport(boolean setToImport) { |
Vidyashree Rama | b367047 | 2016-08-06 15:49:56 +0530 | [diff] [blame] | 105 | isSetToImport = setToImport; |
| 106 | } |
| 107 | |
| 108 | /** |
Bharat saraswal | 63f26fb | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 109 | * Returns the set containing the imported class/interface info. |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 110 | * |
| 111 | * @return the set containing the imported class/interface info |
| 112 | */ |
Shankara-Huawei | b756477 | 2016-08-02 18:13:13 +0530 | [diff] [blame] | 113 | public SortedSet<JavaQualifiedTypeInfoTranslator> getImportSet() { |
Bharat saraswal | 9fab16b | 2016-09-23 23:27:24 +0530 | [diff] [blame^] | 114 | return unmodifiableSortedSet(importSet); |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 115 | } |
| 116 | |
| 117 | /** |
Bharat saraswal | e2bc60d | 2016-04-16 02:28:25 +0530 | [diff] [blame] | 118 | * Adds an imported class/interface info if it is not already part of the |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 119 | * collection. |
Shankara-Huawei | b756477 | 2016-08-02 18:13:13 +0530 | [diff] [blame] | 120 | * <p> |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 121 | * If already part of the collection, check if the packages are same, if so |
| 122 | * then return true, to denote it is already in the import collection, and |
| 123 | * it can be accessed without qualified access. If the packages do not |
| 124 | * match, then do not add to the import collection, and return false to |
| 125 | * denote, it is not added to import collection and needs to be accessed in |
| 126 | * a qualified manner. |
| 127 | * |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 128 | * @param newImportInfo class/interface info being imported |
VinodKumarS-Huawei | d81eccb | 2016-06-01 14:30:22 +0530 | [diff] [blame] | 129 | * @param className name of the call being generated |
| 130 | * @param classPkg generated class package |
| 131 | * @return qualified access status of the import node being added |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 132 | */ |
Shankara-Huawei | b756477 | 2016-08-02 18:13:13 +0530 | [diff] [blame] | 133 | public boolean addImportInfo(JavaQualifiedTypeInfoTranslator newImportInfo, |
| 134 | String className, String classPkg) { |
VinodKumarS-Huawei | d81eccb | 2016-06-01 14:30:22 +0530 | [diff] [blame] | 135 | |
| 136 | if (newImportInfo.getClassInfo().contentEquals(className)) { |
| 137 | /* |
Vidyashree Rama | b367047 | 2016-08-06 15:49:56 +0530 | [diff] [blame] | 138 | * If the current class name is same as the attribute class name, |
VinodKumarS-Huawei | d81eccb | 2016-06-01 14:30:22 +0530 | [diff] [blame] | 139 | * then the attribute must be accessed in a qualified manner. |
| 140 | */ |
| 141 | return true; |
| 142 | } else if (newImportInfo.getPkgInfo() == null) { |
| 143 | /* |
Bharat saraswal | 9fab16b | 2016-09-23 23:27:24 +0530 | [diff] [blame^] | 144 | * If the package info is null, then it is not a candidate for import |
| 145 | * / qualified access |
VinodKumarS-Huawei | d81eccb | 2016-06-01 14:30:22 +0530 | [diff] [blame] | 146 | */ |
| 147 | return false; |
| 148 | } |
| 149 | |
| 150 | /* |
| 151 | * If the attribute type is having the package info, it is contender |
| 152 | * for import list and also need to check if it needs to be a |
| 153 | * qualified access. |
| 154 | */ |
| 155 | if (newImportInfo.getPkgInfo().contentEquals(classPkg)) { |
Shankara-Huawei | b756477 | 2016-08-02 18:13:13 +0530 | [diff] [blame] | 156 | /* |
Bharat saraswal | 9fab16b | 2016-09-23 23:27:24 +0530 | [diff] [blame^] | 157 | * Package of the referred attribute and the generated class is same, |
| 158 | * so no need import |
VinodKumarS-Huawei | d81eccb | 2016-06-01 14:30:22 +0530 | [diff] [blame] | 159 | * or qualified access. |
| 160 | */ |
| 161 | return false; |
| 162 | } |
Bharat saraswal | 84366c5 | 2016-03-23 19:40:35 +0530 | [diff] [blame] | 163 | |
Shankara-Huawei | b756477 | 2016-08-02 18:13:13 +0530 | [diff] [blame] | 164 | for (JavaQualifiedTypeInfoTranslator curImportInfo : getImportSet()) { |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 165 | if (curImportInfo.getClassInfo() |
| 166 | .contentEquals(newImportInfo.getClassInfo())) { |
VinodKumarS-Huawei | d81eccb | 2016-06-01 14:30:22 +0530 | [diff] [blame] | 167 | return !curImportInfo.getPkgInfo() |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 168 | .contentEquals(newImportInfo.getPkgInfo()); |
| 169 | } |
| 170 | } |
Vinod Kumar S | 79a374b | 2016-04-30 21:09:15 +0530 | [diff] [blame] | 171 | |
VinodKumarS-Huawei | d81eccb | 2016-06-01 14:30:22 +0530 | [diff] [blame] | 172 | /* |
Vidyashree Rama | b367047 | 2016-08-06 15:49:56 +0530 | [diff] [blame] | 173 | * Import is added, so it is a member for non qualified access |
VinodKumarS-Huawei | d81eccb | 2016-06-01 14:30:22 +0530 | [diff] [blame] | 174 | */ |
Bharat saraswal | 9fab16b | 2016-09-23 23:27:24 +0530 | [diff] [blame^] | 175 | importSet.add(newImportInfo); |
VinodKumarS-Huawei | d81eccb | 2016-06-01 14:30:22 +0530 | [diff] [blame] | 176 | return false; |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 177 | } |
Bharat saraswal | 84366c5 | 2016-03-23 19:40:35 +0530 | [diff] [blame] | 178 | |
| 179 | /** |
| 180 | * Returns import for class. |
| 181 | * |
Vidyashree Rama | 1396065 | 2016-04-26 15:06:06 +0530 | [diff] [blame] | 182 | * @return imports for class |
| 183 | */ |
| 184 | public List<String> getImports() { |
Vinod Kumar S | 79a374b | 2016-04-30 21:09:15 +0530 | [diff] [blame] | 185 | |
Vidyashree Rama | 1396065 | 2016-04-26 15:06:06 +0530 | [diff] [blame] | 186 | String importString; |
| 187 | List<String> imports = new ArrayList<>(); |
| 188 | |
Shankara-Huawei | b756477 | 2016-08-02 18:13:13 +0530 | [diff] [blame] | 189 | for (JavaQualifiedTypeInfoTranslator importInfo : getImportSet()) { |
Bharat saraswal | 9fab16b | 2016-09-23 23:27:24 +0530 | [diff] [blame^] | 190 | if (!importInfo.getPkgInfo().equals(EMPTY_STRING) && |
| 191 | importInfo.getClassInfo() != null && |
| 192 | !importInfo.getPkgInfo().equals(JAVA_LANG)) { |
| 193 | importString = getImportString(importInfo.getPkgInfo(), importInfo |
| 194 | .getClassInfo()); |
Vidyashree Rama | 1396065 | 2016-04-26 15:06:06 +0530 | [diff] [blame] | 195 | imports.add(importString); |
| 196 | } |
| 197 | } |
Bharat saraswal | 9fab16b | 2016-09-23 23:27:24 +0530 | [diff] [blame^] | 198 | if (isListToImport) { |
Vinod Kumar S | 79a374b | 2016-04-30 21:09:15 +0530 | [diff] [blame] | 199 | imports.add(getImportForList()); |
| 200 | } |
Bharat saraswal | 9fab16b | 2016-09-23 23:27:24 +0530 | [diff] [blame^] | 201 | if (isQueueToImport) { |
Vidyashree Rama | b367047 | 2016-08-06 15:49:56 +0530 | [diff] [blame] | 202 | imports.add(getImportForQueue()); |
| 203 | } |
Bharat saraswal | 9fab16b | 2016-09-23 23:27:24 +0530 | [diff] [blame^] | 204 | if (isSetToImport) { |
Vidyashree Rama | b367047 | 2016-08-06 15:49:56 +0530 | [diff] [blame] | 205 | imports.add(getImportForSet()); |
| 206 | } |
| 207 | |
Vidyashree Rama | 1396065 | 2016-04-26 15:06:06 +0530 | [diff] [blame] | 208 | sort(imports); |
| 209 | return imports; |
| 210 | } |
| 211 | |
| 212 | /** |
Bharat saraswal | 63f26fb | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 213 | * Returns import for hash and equals method. |
Bharat saraswal | 84366c5 | 2016-03-23 19:40:35 +0530 | [diff] [blame] | 214 | * |
| 215 | * @return import for hash and equals method |
| 216 | */ |
Shankara-Huawei | b756477 | 2016-08-02 18:13:13 +0530 | [diff] [blame] | 217 | String getImportForHashAndEquals() { |
Bharat saraswal | 9fab16b | 2016-09-23 23:27:24 +0530 | [diff] [blame^] | 218 | return getImportString(JAVA_UTIL_OBJECTS_IMPORT_PKG, |
| 219 | JAVA_UTIL_OBJECTS_IMPORT_CLASS); |
Bharat saraswal | 84366c5 | 2016-03-23 19:40:35 +0530 | [diff] [blame] | 220 | } |
| 221 | |
| 222 | /** |
Bharat saraswal | 63f26fb | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 223 | * Returns import for to string method. |
Bharat saraswal | 84366c5 | 2016-03-23 19:40:35 +0530 | [diff] [blame] | 224 | * |
| 225 | * @return import for to string method |
| 226 | */ |
Shankara-Huawei | b756477 | 2016-08-02 18:13:13 +0530 | [diff] [blame] | 227 | String getImportForToString() { |
Bharat saraswal | 9fab16b | 2016-09-23 23:27:24 +0530 | [diff] [blame^] | 228 | return getImportString(GOOGLE_MORE_OBJECT_IMPORT_PKG, |
| 229 | GOOGLE_MORE_OBJECT_IMPORT_CLASS); |
Bharat saraswal | 84366c5 | 2016-03-23 19:40:35 +0530 | [diff] [blame] | 230 | } |
| 231 | |
| 232 | /** |
Shankara-Huawei | a1039e5 | 2016-07-14 16:53:09 +0530 | [diff] [blame] | 233 | * Returns import for to bitset method. |
| 234 | * |
| 235 | * @return import for to bitset method |
| 236 | */ |
Shankara-Huawei | b756477 | 2016-08-02 18:13:13 +0530 | [diff] [blame] | 237 | String getImportForToBitSet() { |
Bharat saraswal | 9fab16b | 2016-09-23 23:27:24 +0530 | [diff] [blame^] | 238 | return getImportString(JAVA_UTIL_OBJECTS_IMPORT_PKG, BITSET); |
Shankara-Huawei | a1039e5 | 2016-07-14 16:53:09 +0530 | [diff] [blame] | 239 | } |
| 240 | |
| 241 | /** |
Bharat saraswal | 63f26fb | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 242 | * Returns import for list attribute. |
| 243 | * |
Bharat saraswal | e2bc60d | 2016-04-16 02:28:25 +0530 | [diff] [blame] | 244 | * @return import for list attribute |
Bharat saraswal | 84366c5 | 2016-03-23 19:40:35 +0530 | [diff] [blame] | 245 | */ |
Bharat saraswal | 8beac34 | 2016-08-04 02:00:03 +0530 | [diff] [blame] | 246 | String getImportForList() { |
Bharat saraswal | 9fab16b | 2016-09-23 23:27:24 +0530 | [diff] [blame^] | 247 | return getImportString(COLLECTION_IMPORTS, LIST); |
Bharat saraswal | 84366c5 | 2016-03-23 19:40:35 +0530 | [diff] [blame] | 248 | } |
Bharat saraswal | e2bc60d | 2016-04-16 02:28:25 +0530 | [diff] [blame] | 249 | |
| 250 | /** |
Vidyashree Rama | b367047 | 2016-08-06 15:49:56 +0530 | [diff] [blame] | 251 | * Returns import for queue attribute. |
| 252 | * |
| 253 | * @return import for queue attribute |
| 254 | */ |
Bharat saraswal | 9fab16b | 2016-09-23 23:27:24 +0530 | [diff] [blame^] | 255 | private String getImportForQueue() { |
| 256 | return getImportString(COLLECTION_IMPORTS, QUEUE); |
Vidyashree Rama | b367047 | 2016-08-06 15:49:56 +0530 | [diff] [blame] | 257 | } |
| 258 | |
| 259 | /** |
| 260 | * Returns import for set attribute. |
| 261 | * |
| 262 | * @return import for set attribute |
| 263 | */ |
Bharat saraswal | 9fab16b | 2016-09-23 23:27:24 +0530 | [diff] [blame^] | 264 | private String getImportForSet() { |
| 265 | return getImportString(COLLECTION_IMPORTS, SET); |
Vidyashree Rama | b367047 | 2016-08-06 15:49:56 +0530 | [diff] [blame] | 266 | } |
| 267 | |
| 268 | /** |
Bharat saraswal | 4aaab4d | 2016-05-17 14:19:38 +0530 | [diff] [blame] | 269 | * Returns import string for ListenerService class. |
| 270 | * |
| 271 | * @return import string for ListenerService class |
| 272 | */ |
| 273 | public String getListenerServiceImport() { |
Bharat saraswal | 9fab16b | 2016-09-23 23:27:24 +0530 | [diff] [blame^] | 274 | return getImportString(ONOS_EVENT_PKG, LISTENER_SERVICE); |
Bharat saraswal | 715d3fc | 2016-05-17 19:59:16 +0530 | [diff] [blame] | 275 | } |
| 276 | |
| 277 | /** |
| 278 | * Returns import string for AbstractEvent class. |
| 279 | * |
| 280 | * @return import string for AbstractEvent class |
| 281 | */ |
Shankara-Huawei | b756477 | 2016-08-02 18:13:13 +0530 | [diff] [blame] | 282 | String getAbstractEventsImport() { |
Bharat saraswal | 9fab16b | 2016-09-23 23:27:24 +0530 | [diff] [blame^] | 283 | return getImportString(ONOS_EVENT_PKG, ABSTRACT_EVENT); |
Bharat saraswal | 715d3fc | 2016-05-17 19:59:16 +0530 | [diff] [blame] | 284 | } |
| 285 | |
| 286 | /** |
| 287 | * Returns import string for EventListener class. |
| 288 | * |
| 289 | * @return import string for EventListener class |
| 290 | */ |
Shankara-Huawei | b756477 | 2016-08-02 18:13:13 +0530 | [diff] [blame] | 291 | String getEventListenerImport() { |
Bharat saraswal | 9fab16b | 2016-09-23 23:27:24 +0530 | [diff] [blame^] | 292 | return getImportString(ONOS_EVENT_PKG, EVENT_LISTENER); |
Bharat saraswal | 4aaab4d | 2016-05-17 14:19:38 +0530 | [diff] [blame] | 293 | } |
Bharat saraswal | af413b8 | 2016-07-14 15:18:20 +0530 | [diff] [blame] | 294 | |
| 295 | /** |
| 296 | * Returns import string for map class. |
| 297 | * |
| 298 | * @return import string for map class |
| 299 | */ |
Shankara-Huawei | b756477 | 2016-08-02 18:13:13 +0530 | [diff] [blame] | 300 | String getMapImport() { |
Bharat saraswal | 9fab16b | 2016-09-23 23:27:24 +0530 | [diff] [blame^] | 301 | return getImportString(COLLECTION_IMPORTS, MAP); |
Bharat saraswal | af413b8 | 2016-07-14 15:18:20 +0530 | [diff] [blame] | 302 | } |
| 303 | |
| 304 | /** |
| 305 | * Returns import string for hash map class. |
| 306 | * |
| 307 | * @return import string for hash map class |
| 308 | */ |
Shankara-Huawei | b756477 | 2016-08-02 18:13:13 +0530 | [diff] [blame] | 309 | String getHashMapImport() { |
Bharat saraswal | 9fab16b | 2016-09-23 23:27:24 +0530 | [diff] [blame^] | 310 | return getImportString(COLLECTION_IMPORTS, HASH_MAP); |
Bharat saraswal | af413b8 | 2016-07-14 15:18:20 +0530 | [diff] [blame] | 311 | } |
| 312 | |
| 313 | /** |
Bharat saraswal | 64e7e23 | 2016-07-14 23:33:55 +0530 | [diff] [blame] | 314 | * Returns import for big integer. |
| 315 | * |
| 316 | * @return import for big integer |
| 317 | */ |
| 318 | public String getBigIntegerImport() { |
Bharat saraswal | 9fab16b | 2016-09-23 23:27:24 +0530 | [diff] [blame^] | 319 | return getImportString(JAVA_MATH, BIG_INTEGER); |
Bharat saraswal | 64e7e23 | 2016-07-14 23:33:55 +0530 | [diff] [blame] | 320 | } |
Bharat saraswal | 9fab16b | 2016-09-23 23:27:24 +0530 | [diff] [blame^] | 321 | |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 322 | } |