Vinod Kumar S | 3804650 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2016-present Open Networking Laboratory |
Vinod Kumar S | 3804650 | 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 | |
| 17 | package org.onosproject.yangutils.translator.tojava; |
| 18 | |
Vinod Kumar S | 3804650 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 19 | import java.io.IOException; |
Vinod Kumar S | e4b9b0c | 2016-04-30 21:09:15 +0530 | [diff] [blame^] | 20 | |
| 21 | import org.onosproject.yangutils.datamodel.YangTypeContainer; |
Vinod Kumar S | 3804650 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 22 | import org.onosproject.yangutils.datamodel.YangNode; |
Bharat saraswal | 6ef0b76 | 2016-04-05 12:45:45 +0530 | [diff] [blame] | 23 | import org.onosproject.yangutils.translator.exception.TranslatorException; |
Vinod Kumar S | 3804650 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 24 | |
Bharat saraswal | d72411a | 2016-04-19 01:00:16 +0530 | [diff] [blame] | 25 | import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_ENUM_CLASS; |
Vinod Kumar S | e4b9b0c | 2016-04-30 21:09:15 +0530 | [diff] [blame^] | 26 | import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_INTERFACE_WITH_BUILDER; |
Gaurav Agrawal | 5652766 | 2016-04-20 15:49:17 +0530 | [diff] [blame] | 27 | import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_RPC_INTERFACE; |
Vinod Kumar S | e4b9b0c | 2016-04-30 21:09:15 +0530 | [diff] [blame^] | 28 | import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_TYPE_CLASS; |
| 29 | import static org.onosproject.yangutils.translator.tojava.utils.JavaFileGenerator.getExtendsList; |
Vinod Kumar S | 3804650 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 30 | |
| 31 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 32 | * Represents implementation of java code fragments temporary implementations. |
Vinod Kumar S | 3804650 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 33 | */ |
| 34 | public class TempJavaCodeFragmentFiles { |
| 35 | |
| 36 | /** |
Vinod Kumar S | e4b9b0c | 2016-04-30 21:09:15 +0530 | [diff] [blame^] | 37 | * Has the temporary files required for bean generated classes. |
Vinod Kumar S | 3804650 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 38 | */ |
Vinod Kumar S | e4b9b0c | 2016-04-30 21:09:15 +0530 | [diff] [blame^] | 39 | private TempJavaBeanFragmentFiles beanTempFiles; |
Vinod Kumar S | 3804650 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 40 | |
| 41 | /** |
Vinod Kumar S | e4b9b0c | 2016-04-30 21:09:15 +0530 | [diff] [blame^] | 42 | * Has the temporary files required for bean generated classes. |
Bharat saraswal | e2d51d6 | 2016-03-23 19:40:35 +0530 | [diff] [blame] | 43 | */ |
Vinod Kumar S | e4b9b0c | 2016-04-30 21:09:15 +0530 | [diff] [blame^] | 44 | private TempJavaTypeFragmentFiles typeTempFiles; |
Bharat saraswal | e2d51d6 | 2016-03-23 19:40:35 +0530 | [diff] [blame] | 45 | |
| 46 | /** |
Vinod Kumar S | e4b9b0c | 2016-04-30 21:09:15 +0530 | [diff] [blame^] | 47 | * Has the temporary files required for service generated classes. |
Vinod Kumar S | 3804650 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 48 | */ |
Vinod Kumar S | e4b9b0c | 2016-04-30 21:09:15 +0530 | [diff] [blame^] | 49 | private TempJavaServiceFragmentFiles serviceTempFiles; |
Vinod Kumar S | 3804650 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 50 | |
| 51 | /** |
Vinod Kumar S | e4b9b0c | 2016-04-30 21:09:15 +0530 | [diff] [blame^] | 52 | * Has the temporary files required for enumeration generated classes. |
Vinod Kumar S | 3804650 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 53 | */ |
Vinod Kumar S | e4b9b0c | 2016-04-30 21:09:15 +0530 | [diff] [blame^] | 54 | private TempJavaEnumerationFragmentFiles enumerationTempFiles; |
Bharat saraswal | d72411a | 2016-04-19 01:00:16 +0530 | [diff] [blame] | 55 | |
Bharat saraswal | 2f11f65 | 2016-03-25 18:19:46 +0530 | [diff] [blame] | 56 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 57 | * Creates an instance of temporary java code fragment. |
Vinod Kumar S | 3804650 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 58 | * |
Vinod Kumar S | e4b9b0c | 2016-04-30 21:09:15 +0530 | [diff] [blame^] | 59 | * @param javaFileInfo generated java file info |
Vinod Kumar S | 3804650 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 60 | * @throws IOException when fails to create new file handle |
| 61 | */ |
Vinod Kumar S | e4b9b0c | 2016-04-30 21:09:15 +0530 | [diff] [blame^] | 62 | public TempJavaCodeFragmentFiles(JavaFileInfo javaFileInfo) |
Bharat saraswal | e2d51d6 | 2016-03-23 19:40:35 +0530 | [diff] [blame] | 63 | throws IOException { |
Vinod Kumar S | 3804650 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 64 | |
Vinod Kumar S | e4b9b0c | 2016-04-30 21:09:15 +0530 | [diff] [blame^] | 65 | if ((javaFileInfo.getGeneratedFileTypes() & GENERATE_INTERFACE_WITH_BUILDER) != 0) { |
| 66 | setBeanTempFiles(new TempJavaBeanFragmentFiles(javaFileInfo)); |
Vinod Kumar S | 3804650 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 67 | } |
| 68 | |
| 69 | /** |
Vinod Kumar S | e4b9b0c | 2016-04-30 21:09:15 +0530 | [diff] [blame^] | 70 | * Creates user defined data type class file. |
Vinod Kumar S | 3804650 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 71 | */ |
Vinod Kumar S | e4b9b0c | 2016-04-30 21:09:15 +0530 | [diff] [blame^] | 72 | if ((javaFileInfo.getGeneratedFileTypes() & GENERATE_TYPE_CLASS) != 0) { |
| 73 | setTypeTempFiles(new TempJavaTypeFragmentFiles(javaFileInfo)); |
Vinod Kumar S | 3804650 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 74 | } |
| 75 | |
| 76 | /** |
Vinod Kumar S | e4b9b0c | 2016-04-30 21:09:15 +0530 | [diff] [blame^] | 77 | * Creates enumeration class file. |
Vinod Kumar S | 3804650 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 78 | */ |
Vinod Kumar S | e4b9b0c | 2016-04-30 21:09:15 +0530 | [diff] [blame^] | 79 | if ((javaFileInfo.getGeneratedFileTypes() & GENERATE_ENUM_CLASS) != 0) { |
| 80 | setEnumerationTempFiles(new TempJavaEnumerationFragmentFiles(javaFileInfo)); |
| 81 | } |
| 82 | |
| 83 | if ((javaFileInfo.getGeneratedFileTypes() & GENERATE_RPC_INTERFACE) != 0) { |
| 84 | setServiceTempFiles(new TempJavaServiceFragmentFiles(javaFileInfo)); |
| 85 | } |
| 86 | } |
| 87 | |
| 88 | /** |
| 89 | * Retrieves the temp file handle for bean file generation. |
| 90 | * |
| 91 | * @return temp file handle for bean file generation |
| 92 | */ |
| 93 | public TempJavaBeanFragmentFiles getBeanTempFiles() { |
| 94 | return beanTempFiles; |
| 95 | } |
| 96 | |
| 97 | /** |
| 98 | * Sets temp file handle for bean file generation. |
| 99 | * |
| 100 | * @param beanTempFiles temp file handle for bean file generation |
| 101 | */ |
| 102 | public void setBeanTempFiles(TempJavaBeanFragmentFiles beanTempFiles) { |
| 103 | this.beanTempFiles = beanTempFiles; |
| 104 | } |
| 105 | |
| 106 | |
| 107 | /** |
| 108 | * Retrieves the temp file handle for data type file generation. |
| 109 | * |
| 110 | * @return temp file handle for data type file generation |
| 111 | */ |
| 112 | public TempJavaTypeFragmentFiles getTypeTempFiles() { |
| 113 | return typeTempFiles; |
| 114 | } |
| 115 | |
| 116 | |
| 117 | /** |
| 118 | * Sets temp file handle for data type file generation. |
| 119 | * |
| 120 | * @param typeTempFiles temp file handle for data type file generation |
| 121 | */ |
| 122 | public void setTypeTempFiles(TempJavaTypeFragmentFiles typeTempFiles) { |
| 123 | this.typeTempFiles = typeTempFiles; |
| 124 | } |
| 125 | |
| 126 | /** |
| 127 | * Retrieves the temp file handle for service file generation. |
| 128 | * |
| 129 | * @return temp file handle for service file generation |
| 130 | */ |
| 131 | public TempJavaServiceFragmentFiles getServiceTempFiles() { |
| 132 | return serviceTempFiles; |
| 133 | } |
| 134 | |
| 135 | /** |
| 136 | * Sets temp file handle for service file generation. |
| 137 | * |
| 138 | * @param serviceTempFiles temp file handle for service file generation |
| 139 | */ |
| 140 | public void setServiceTempFiles(TempJavaServiceFragmentFiles serviceTempFiles) { |
| 141 | this.serviceTempFiles = serviceTempFiles; |
| 142 | } |
| 143 | |
| 144 | /** |
| 145 | * Retrieves the temp file handle for enumeration file generation. |
| 146 | * |
| 147 | * @return temp file handle for enumeration file generation |
| 148 | */ |
| 149 | public TempJavaEnumerationFragmentFiles getEnumerationTempFiles() { |
| 150 | return enumerationTempFiles; |
| 151 | } |
| 152 | |
| 153 | /** |
| 154 | * Sets temp file handle for enumeration file generation. |
| 155 | * |
| 156 | * @param enumerationTempFiles temp file handle for enumeration file generation |
| 157 | */ |
| 158 | public void setEnumerationTempFiles( |
| 159 | TempJavaEnumerationFragmentFiles enumerationTempFiles) { |
| 160 | this.enumerationTempFiles = enumerationTempFiles; |
| 161 | } |
| 162 | |
| 163 | /** |
| 164 | * Constructs java code exit. |
| 165 | * |
| 166 | * @param fileType generated file type |
| 167 | * @param curNode current YANG node |
| 168 | * @throws IOException when fails to generate java files |
| 169 | */ |
| 170 | public void generateJavaFile(int fileType, YangNode curNode) |
| 171 | throws IOException { |
| 172 | |
| 173 | if (getBeanTempFiles() != null) { |
| 174 | getBeanTempFiles().generateJavaFile(fileType, curNode); |
Vinod Kumar S | 3804650 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 175 | } |
| 176 | |
| 177 | /** |
Vinod Kumar S | e4b9b0c | 2016-04-30 21:09:15 +0530 | [diff] [blame^] | 178 | * Creates user defined data type class file. |
Vinod Kumar S | 3804650 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 179 | */ |
Vinod Kumar S | e4b9b0c | 2016-04-30 21:09:15 +0530 | [diff] [blame^] | 180 | if (getTypeTempFiles() != null) { |
| 181 | getTypeTempFiles().generateJavaFile(fileType, curNode); |
Vinod Kumar S | 3804650 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 182 | } |
| 183 | |
Vinod Kumar S | e4b9b0c | 2016-04-30 21:09:15 +0530 | [diff] [blame^] | 184 | } |
| 185 | |
| 186 | /** |
| 187 | * Adds the new attribute info to the target generated temporary files. |
| 188 | * |
| 189 | * @param newAttrInfo the attribute info that needs to be added to temporary |
| 190 | * files |
| 191 | * @throws IOException IO operation fail |
| 192 | */ |
| 193 | public void addJavaSnippetInfoToApplicableTempFiles(JavaAttributeInfo newAttrInfo) |
| 194 | throws IOException { |
| 195 | |
| 196 | if (getBeanTempFiles() != null) { |
| 197 | getBeanTempFiles() |
| 198 | .addJavaSnippetInfoToApplicableTempFiles(newAttrInfo); |
Gaurav Agrawal | 5652766 | 2016-04-20 15:49:17 +0530 | [diff] [blame] | 199 | } |
| 200 | |
Bharat saraswal | e2d51d6 | 2016-03-23 19:40:35 +0530 | [diff] [blame] | 201 | /** |
Vinod Kumar S | e4b9b0c | 2016-04-30 21:09:15 +0530 | [diff] [blame^] | 202 | * Creates user defined data type class file. |
Bharat saraswal | e2d51d6 | 2016-03-23 19:40:35 +0530 | [diff] [blame] | 203 | */ |
Vinod Kumar S | e4b9b0c | 2016-04-30 21:09:15 +0530 | [diff] [blame^] | 204 | if (getTypeTempFiles() != null) { |
| 205 | getTypeTempFiles() |
| 206 | .addJavaSnippetInfoToApplicableTempFiles(newAttrInfo); |
Gaurav Agrawal | 338735b | 2016-04-18 18:53:11 +0530 | [diff] [blame] | 207 | } |
Vinod Kumar S | 3804650 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 208 | } |
| 209 | |
| 210 | /** |
Vinod Kumar S | e4b9b0c | 2016-04-30 21:09:15 +0530 | [diff] [blame^] | 211 | * Adds all the leaves in the current data model node as part of the |
| 212 | * generated temporary file. |
Bharat saraswal | e2d51d6 | 2016-03-23 19:40:35 +0530 | [diff] [blame] | 213 | * |
Vinod Kumar S | e4b9b0c | 2016-04-30 21:09:15 +0530 | [diff] [blame^] | 214 | * @param curNode java file info of the generated file |
| 215 | * @throws IOException IO operation fail |
Bharat saraswal | e2d51d6 | 2016-03-23 19:40:35 +0530 | [diff] [blame] | 216 | */ |
Vinod Kumar S | e4b9b0c | 2016-04-30 21:09:15 +0530 | [diff] [blame^] | 217 | public void addCurNodeLeavesInfoToTempFiles(YangNode curNode) |
| 218 | throws IOException { |
Bharat saraswal | e2d51d6 | 2016-03-23 19:40:35 +0530 | [diff] [blame] | 219 | |
Vinod Kumar S | e4b9b0c | 2016-04-30 21:09:15 +0530 | [diff] [blame^] | 220 | if (getBeanTempFiles() != null) { |
| 221 | getBeanTempFiles().addCurNodeLeavesInfoToTempFiles(curNode); |
Bharat saraswal | 2f11f65 | 2016-03-25 18:19:46 +0530 | [diff] [blame] | 222 | } |
Vinod Kumar S | e4b9b0c | 2016-04-30 21:09:15 +0530 | [diff] [blame^] | 223 | |
Bharat saraswal | e2d51d6 | 2016-03-23 19:40:35 +0530 | [diff] [blame] | 224 | } |
| 225 | |
| 226 | /** |
Vinod Kumar S | e4b9b0c | 2016-04-30 21:09:15 +0530 | [diff] [blame^] | 227 | * Add all the type in the current data model node as part of the |
| 228 | * generated temporary file. |
Bharat saraswal | e2d51d6 | 2016-03-23 19:40:35 +0530 | [diff] [blame] | 229 | * |
Vinod Kumar S | e4b9b0c | 2016-04-30 21:09:15 +0530 | [diff] [blame^] | 230 | * @param yangTypeContainer YANG java data model node which has type info, eg union / typedef |
| 231 | * @throws IOException IO operation fail |
Bharat saraswal | e2d51d6 | 2016-03-23 19:40:35 +0530 | [diff] [blame] | 232 | */ |
Vinod Kumar S | e4b9b0c | 2016-04-30 21:09:15 +0530 | [diff] [blame^] | 233 | public void addTypeInfoToTempFiles(YangTypeContainer yangTypeContainer) |
| 234 | throws IOException { |
Bharat saraswal | e2d51d6 | 2016-03-23 19:40:35 +0530 | [diff] [blame] | 235 | |
Vinod Kumar S | e4b9b0c | 2016-04-30 21:09:15 +0530 | [diff] [blame^] | 236 | if (getTypeTempFiles() != null) { |
| 237 | getTypeTempFiles() |
| 238 | .addTypeInfoToTempFiles(yangTypeContainer); |
| 239 | } |
Bharat saraswal | cc1cdab | 2016-04-16 02:28:25 +0530 | [diff] [blame] | 240 | } |
| 241 | |
| 242 | /** |
| 243 | * Adds class to the extends list. |
| 244 | * |
| 245 | * @param extend class to be extended |
| 246 | */ |
| 247 | public void addToExtendsList(String extend) { |
| 248 | getExtendsList().add(extend); |
| 249 | } |
| 250 | |
| 251 | /** |
Vinod Kumar S | 3804650 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 252 | * Adds build method for interface. |
| 253 | * |
| 254 | * @return build method for interface |
Vinod Kumar S | 3804650 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 255 | * @throws IOException when fails to append to temporary file |
| 256 | */ |
Vinod Kumar S | e4b9b0c | 2016-04-30 21:09:15 +0530 | [diff] [blame^] | 257 | public String addBuildMethodForInterface() |
| 258 | throws IOException { |
| 259 | if (getBeanTempFiles() != null) { |
| 260 | return getBeanTempFiles().addBuildMethodForInterface(); |
| 261 | } |
| 262 | throw new TranslatorException("build method only supported for bean class"); |
Vinod Kumar S | 3804650 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 263 | } |
| 264 | |
| 265 | /** |
| 266 | * Adds default constructor for class. |
| 267 | * |
Bharat saraswal | e2d51d6 | 2016-03-23 19:40:35 +0530 | [diff] [blame] | 268 | * @param modifier modifier for constructor. |
| 269 | * @param toAppend string which need to be appended with the class name |
Vinod Kumar S | 3804650 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 270 | * @return default constructor for class |
Vinod Kumar S | 3804650 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 271 | * @throws IOException when fails to append to file |
| 272 | */ |
Vinod Kumar S | e4b9b0c | 2016-04-30 21:09:15 +0530 | [diff] [blame^] | 273 | public String addDefaultConstructor(String modifier, String toAppend) |
| 274 | throws IOException { |
| 275 | if (getTypeTempFiles() != null) { |
| 276 | return getTypeTempFiles() |
| 277 | .addDefaultConstructor(modifier, toAppend); |
Vinod Kumar S | 3804650 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 278 | } |
Vinod Kumar S | e4b9b0c | 2016-04-30 21:09:15 +0530 | [diff] [blame^] | 279 | |
| 280 | if (getBeanTempFiles() != null) { |
| 281 | return getBeanTempFiles().addDefaultConstructor(modifier, toAppend); |
| 282 | } |
| 283 | |
| 284 | throw new TranslatorException("default constructor should not be added"); |
| 285 | } |
| 286 | |
| 287 | |
| 288 | /** |
| 289 | * Adds build method's implementation for class. |
| 290 | * |
| 291 | * @return build method implementation for class |
| 292 | * @throws IOException when fails to append to temporary file |
| 293 | */ |
| 294 | public String addBuildMethodImpl() |
| 295 | throws IOException { |
| 296 | if (getBeanTempFiles() != null) { |
| 297 | return getBeanTempFiles().addBuildMethodImpl(); |
| 298 | } |
| 299 | |
| 300 | throw new TranslatorException("build should not be added"); |
Vinod Kumar S | 3804650 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 301 | } |
| 302 | |
| 303 | /** |
Vinod Kumar S | e4b9b0c | 2016-04-30 21:09:15 +0530 | [diff] [blame^] | 304 | * Removes all temporary file handles. |
Vinod Kumar S | 3804650 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 305 | * |
Vinod Kumar S | e4b9b0c | 2016-04-30 21:09:15 +0530 | [diff] [blame^] | 306 | * @param isErrorOccurred when translator fails to generate java files we need to close |
| 307 | * all open file handles include temporary files and java files. |
| 308 | * @throws IOException when failed to delete the temporary files |
Vinod Kumar S | 3804650 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 309 | */ |
Vinod Kumar S | e4b9b0c | 2016-04-30 21:09:15 +0530 | [diff] [blame^] | 310 | public void close(boolean isErrorOccurred) |
| 311 | throws IOException { |
Vinod Kumar S | 3804650 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 312 | |
Vinod Kumar S | e4b9b0c | 2016-04-30 21:09:15 +0530 | [diff] [blame^] | 313 | if (getBeanTempFiles() != null) { |
| 314 | getBeanTempFiles().close(isErrorOccurred); |
Vidyashree Rama | 7142d9c | 2016-04-26 15:06:06 +0530 | [diff] [blame] | 315 | } |
| 316 | |
Vinod Kumar S | e4b9b0c | 2016-04-30 21:09:15 +0530 | [diff] [blame^] | 317 | if (getTypeTempFiles() != null) { |
| 318 | getTypeTempFiles().close(isErrorOccurred); |
Vidyashree Rama | 7142d9c | 2016-04-26 15:06:06 +0530 | [diff] [blame] | 319 | } |
| 320 | |
Vinod Kumar S | e4b9b0c | 2016-04-30 21:09:15 +0530 | [diff] [blame^] | 321 | if (getEnumerationTempFiles() != null) { |
| 322 | getEnumerationTempFiles().close(isErrorOccurred); |
Vinod Kumar S | 3804650 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 323 | } |
| 324 | } |
| 325 | |
Gaurav Agrawal | 338735b | 2016-04-18 18:53:11 +0530 | [diff] [blame] | 326 | |
| 327 | /** |
Bharat saraswal | d72411a | 2016-04-19 01:00:16 +0530 | [diff] [blame] | 328 | * Adds enum attributes to temporary files. |
| 329 | * |
| 330 | * @param curNode current YANG node |
| 331 | * @throws IOException when fails to do IO operations |
| 332 | */ |
Vinod Kumar S | e4b9b0c | 2016-04-30 21:09:15 +0530 | [diff] [blame^] | 333 | public void addEnumAttributeToTempFiles(YangNode curNode) |
Gaurav Agrawal | 338735b | 2016-04-18 18:53:11 +0530 | [diff] [blame] | 334 | throws IOException { |
| 335 | |
Vinod Kumar S | e4b9b0c | 2016-04-30 21:09:15 +0530 | [diff] [blame^] | 336 | if (getEnumerationTempFiles() != null) { |
| 337 | getEnumerationTempFiles().addEnumAttributeToTempFiles(curNode); |
| 338 | return; |
Gaurav Agrawal | 338735b | 2016-04-18 18:53:11 +0530 | [diff] [blame] | 339 | } |
Vinod Kumar S | e4b9b0c | 2016-04-30 21:09:15 +0530 | [diff] [blame^] | 340 | |
| 341 | throw new TranslatorException("build should not be added"); |
Bharat saraswal | e2d51d6 | 2016-03-23 19:40:35 +0530 | [diff] [blame] | 342 | } |
| 343 | |
Vinod Kumar S | 3804650 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 344 | } |