Committed by
Gerrit Code Review
Review comments fix for the code in master
Change-Id: I7b492cb3060d2eb83667eb52e4cb2fbfafd3415e
Showing
4 changed files
with
41 additions
and
14 deletions
| ... | @@ -76,7 +76,8 @@ import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.resolveLi | ... | @@ -76,7 +76,8 @@ import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.resolveLi |
| 76 | /** | 76 | /** |
| 77 | * Represents data model node to maintain information defined in YANG sub-module. | 77 | * Represents data model node to maintain information defined in YANG sub-module. |
| 78 | */ | 78 | */ |
| 79 | -public class YangSubModule extends YangNode | 79 | +public class YangSubModule |
| 80 | + extends YangNode | ||
| 80 | implements YangLeavesHolder, YangDesc, YangReference, Parsable, CollisionDetector, YangReferenceResolver, | 81 | implements YangLeavesHolder, YangDesc, YangReference, Parsable, CollisionDetector, YangReferenceResolver, |
| 81 | RpcNotificationContainer { | 82 | RpcNotificationContainer { |
| 82 | 83 | ||
| ... | @@ -150,6 +151,7 @@ public class YangSubModule extends YangNode | ... | @@ -150,6 +151,7 @@ public class YangSubModule extends YangNode |
| 150 | * Prefix of parent module. | 151 | * Prefix of parent module. |
| 151 | */ | 152 | */ |
| 152 | private String prefix; | 153 | private String prefix; |
| 154 | + | ||
| 153 | /*- | 155 | /*- |
| 154 | * Reference RFC 6020. | 156 | * Reference RFC 6020. |
| 155 | * | 157 | * |
| ... | @@ -331,7 +333,8 @@ public class YangSubModule extends YangNode | ... | @@ -331,7 +333,8 @@ public class YangSubModule extends YangNode |
| 331 | } | 333 | } |
| 332 | 334 | ||
| 333 | @Override | 335 | @Override |
| 334 | - public void resolveSelfFileLinking() throws DataModelException { | 336 | + public void resolveSelfFileLinking() |
| 337 | + throws DataModelException { | ||
| 335 | // Get the list to be resolved. | 338 | // Get the list to be resolved. |
| 336 | List<YangResolutionInfo> resolutionList = getUnresolvedResolutionList(); | 339 | List<YangResolutionInfo> resolutionList = getUnresolvedResolutionList(); |
| 337 | // Resolve linking for a resolution list. | 340 | // Resolve linking for a resolution list. |
| ... | @@ -468,7 +471,8 @@ public class YangSubModule extends YangNode | ... | @@ -468,7 +471,8 @@ public class YangSubModule extends YangNode |
| 468 | * @throws DataModelException a violation of data model rules | 471 | * @throws DataModelException a violation of data model rules |
| 469 | */ | 472 | */ |
| 470 | @Override | 473 | @Override |
| 471 | - public void validateDataOnEntry() throws DataModelException { | 474 | + public void validateDataOnEntry() |
| 475 | + throws DataModelException { | ||
| 472 | // TODO auto-generated method stub, to be implemented by parser | 476 | // TODO auto-generated method stub, to be implemented by parser |
| 473 | } | 477 | } |
| 474 | 478 | ||
| ... | @@ -478,18 +482,21 @@ public class YangSubModule extends YangNode | ... | @@ -478,18 +482,21 @@ public class YangSubModule extends YangNode |
| 478 | * @throws DataModelException a violation of data model rules | 482 | * @throws DataModelException a violation of data model rules |
| 479 | */ | 483 | */ |
| 480 | @Override | 484 | @Override |
| 481 | - public void validateDataOnExit() throws DataModelException { | 485 | + public void validateDataOnExit() |
| 486 | + throws DataModelException { | ||
| 482 | // TODO auto-generated method stub, to be implemented by parser | 487 | // TODO auto-generated method stub, to be implemented by parser |
| 483 | } | 488 | } |
| 484 | 489 | ||
| 485 | @Override | 490 | @Override |
| 486 | - public void detectCollidingChild(String identifierName, YangConstructType dataType) throws DataModelException { | 491 | + public void detectCollidingChild(String identifierName, YangConstructType dataType) |
| 492 | + throws DataModelException { | ||
| 487 | // Asks helper to detect colliding child. | 493 | // Asks helper to detect colliding child. |
| 488 | detectCollidingChildUtil(identifierName, dataType, this); | 494 | detectCollidingChildUtil(identifierName, dataType, this); |
| 489 | } | 495 | } |
| 490 | 496 | ||
| 491 | @Override | 497 | @Override |
| 492 | - public void detectSelfCollision(String identifierName, YangConstructType dataType) throws DataModelException { | 498 | + public void detectSelfCollision(String identifierName, YangConstructType dataType) |
| 499 | + throws DataModelException { | ||
| 493 | // Not required as module doesn't have any parent. | 500 | // Not required as module doesn't have any parent. |
| 494 | } | 501 | } |
| 495 | 502 | ... | ... |
utils/yangutils/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaFragmentFiles.java
| ... | @@ -114,31 +114,38 @@ public class TempJavaFragmentFiles { | ... | @@ -114,31 +114,38 @@ public class TempJavaFragmentFiles { |
| 114 | * Information about the java files being generated. | 114 | * Information about the java files being generated. |
| 115 | */ | 115 | */ |
| 116 | private JavaFileInfo javaFileInfo; | 116 | private JavaFileInfo javaFileInfo; |
| 117 | + | ||
| 117 | /** | 118 | /** |
| 118 | * Imported class info. | 119 | * Imported class info. |
| 119 | */ | 120 | */ |
| 120 | private JavaImportData javaImportData; | 121 | private JavaImportData javaImportData; |
| 122 | + | ||
| 121 | /** | 123 | /** |
| 122 | * The variable which guides the types of temporary files generated using | 124 | * The variable which guides the types of temporary files generated using |
| 123 | * the temporary generated file types mask. | 125 | * the temporary generated file types mask. |
| 124 | */ | 126 | */ |
| 125 | private int generatedTempFiles; | 127 | private int generatedTempFiles; |
| 128 | + | ||
| 126 | /** | 129 | /** |
| 127 | * Absolute path where the target java file needs to be generated. | 130 | * Absolute path where the target java file needs to be generated. |
| 128 | */ | 131 | */ |
| 129 | private String absoluteDirPath; | 132 | private String absoluteDirPath; |
| 133 | + | ||
| 130 | /** | 134 | /** |
| 131 | * Contains all the interface(s)/class name which will be extended by generated files. | 135 | * Contains all the interface(s)/class name which will be extended by generated files. |
| 132 | */ | 136 | */ |
| 133 | private List<String> extendsList = new ArrayList<>(); | 137 | private List<String> extendsList = new ArrayList<>(); |
| 138 | + | ||
| 134 | /** | 139 | /** |
| 135 | * File type extension for java classes. | 140 | * File type extension for java classes. |
| 136 | */ | 141 | */ |
| 137 | private static final String JAVA_FILE_EXTENSION = ".java"; | 142 | private static final String JAVA_FILE_EXTENSION = ".java"; |
| 143 | + | ||
| 138 | /** | 144 | /** |
| 139 | * File type extension for temporary classes. | 145 | * File type extension for temporary classes. |
| 140 | */ | 146 | */ |
| 141 | private static final String TEMP_FILE_EXTENSION = ".tmp"; | 147 | private static final String TEMP_FILE_EXTENSION = ".tmp"; |
| 148 | + | ||
| 142 | /** | 149 | /** |
| 143 | * Folder suffix for temporary files folder. | 150 | * Folder suffix for temporary files folder. |
| 144 | */ | 151 | */ |
| ... | @@ -168,14 +175,17 @@ public class TempJavaFragmentFiles { | ... | @@ -168,14 +175,17 @@ public class TempJavaFragmentFiles { |
| 168 | * File name for attributes. | 175 | * File name for attributes. |
| 169 | */ | 176 | */ |
| 170 | private static final String ATTRIBUTE_FILE_NAME = "Attributes"; | 177 | private static final String ATTRIBUTE_FILE_NAME = "Attributes"; |
| 178 | + | ||
| 171 | /** | 179 | /** |
| 172 | * File name for to string method. | 180 | * File name for to string method. |
| 173 | */ | 181 | */ |
| 174 | private static final String TO_STRING_METHOD_FILE_NAME = "ToString"; | 182 | private static final String TO_STRING_METHOD_FILE_NAME = "ToString"; |
| 183 | + | ||
| 175 | /** | 184 | /** |
| 176 | * File name for hash code method. | 185 | * File name for hash code method. |
| 177 | */ | 186 | */ |
| 178 | private static final String HASH_CODE_METHOD_FILE_NAME = "HashCode"; | 187 | private static final String HASH_CODE_METHOD_FILE_NAME = "HashCode"; |
| 188 | + | ||
| 179 | /** | 189 | /** |
| 180 | * File name for equals method. | 190 | * File name for equals method. |
| 181 | */ | 191 | */ |
| ... | @@ -190,14 +200,17 @@ public class TempJavaFragmentFiles { | ... | @@ -190,14 +200,17 @@ public class TempJavaFragmentFiles { |
| 190 | * File name for interface java file name suffix. | 200 | * File name for interface java file name suffix. |
| 191 | */ | 201 | */ |
| 192 | private static final String INTERFACE_FILE_NAME_SUFFIX = EMPTY_STRING; | 202 | private static final String INTERFACE_FILE_NAME_SUFFIX = EMPTY_STRING; |
| 203 | + | ||
| 193 | /** | 204 | /** |
| 194 | * File name for builder interface file name suffix. | 205 | * File name for builder interface file name suffix. |
| 195 | */ | 206 | */ |
| 196 | private static final String BUILDER_INTERFACE_FILE_NAME_SUFFIX = BUILDER + INTERFACE; | 207 | private static final String BUILDER_INTERFACE_FILE_NAME_SUFFIX = BUILDER + INTERFACE; |
| 208 | + | ||
| 197 | /** | 209 | /** |
| 198 | * File name for builder class file name suffix. | 210 | * File name for builder class file name suffix. |
| 199 | */ | 211 | */ |
| 200 | private static final String BUILDER_CLASS_FILE_NAME_SUFFIX = BUILDER; | 212 | private static final String BUILDER_CLASS_FILE_NAME_SUFFIX = BUILDER; |
| 213 | + | ||
| 201 | /** | 214 | /** |
| 202 | * File name for impl class file name suffix. | 215 | * File name for impl class file name suffix. |
| 203 | */ | 216 | */ |
| ... | @@ -212,14 +225,17 @@ public class TempJavaFragmentFiles { | ... | @@ -212,14 +225,17 @@ public class TempJavaFragmentFiles { |
| 212 | * Java file handle for interface file. | 225 | * Java file handle for interface file. |
| 213 | */ | 226 | */ |
| 214 | private File interfaceJavaFileHandle; | 227 | private File interfaceJavaFileHandle; |
| 228 | + | ||
| 215 | /** | 229 | /** |
| 216 | * Java file handle for builder interface file. | 230 | * Java file handle for builder interface file. |
| 217 | */ | 231 | */ |
| 218 | private File builderInterfaceJavaFileHandle; | 232 | private File builderInterfaceJavaFileHandle; |
| 233 | + | ||
| 219 | /** | 234 | /** |
| 220 | * Java file handle for builder class file. | 235 | * Java file handle for builder class file. |
| 221 | */ | 236 | */ |
| 222 | private File builderClassJavaFileHandle; | 237 | private File builderClassJavaFileHandle; |
| 238 | + | ||
| 223 | /** | 239 | /** |
| 224 | * Java file handle for impl class file. | 240 | * Java file handle for impl class file. |
| 225 | */ | 241 | */ |
| ... | @@ -254,14 +270,17 @@ public class TempJavaFragmentFiles { | ... | @@ -254,14 +270,17 @@ public class TempJavaFragmentFiles { |
| 254 | * Temporary file handle for hash code method of class. | 270 | * Temporary file handle for hash code method of class. |
| 255 | */ | 271 | */ |
| 256 | private File hashCodeImplTempFileHandle; | 272 | private File hashCodeImplTempFileHandle; |
| 273 | + | ||
| 257 | /** | 274 | /** |
| 258 | * Temporary file handle for equals method of class. | 275 | * Temporary file handle for equals method of class. |
| 259 | */ | 276 | */ |
| 260 | private File equalsImplTempFileHandle; | 277 | private File equalsImplTempFileHandle; |
| 278 | + | ||
| 261 | /** | 279 | /** |
| 262 | * Temporary file handle for to string method of class. | 280 | * Temporary file handle for to string method of class. |
| 263 | */ | 281 | */ |
| 264 | private File toStringImplTempFileHandle; | 282 | private File toStringImplTempFileHandle; |
| 283 | + | ||
| 265 | /** | 284 | /** |
| 266 | * Temporary file handle for enum class file. | 285 | * Temporary file handle for enum class file. |
| 267 | */ | 286 | */ |
| ... | @@ -276,18 +295,17 @@ public class TempJavaFragmentFiles { | ... | @@ -276,18 +295,17 @@ public class TempJavaFragmentFiles { |
| 276 | * Is attribute added. | 295 | * Is attribute added. |
| 277 | */ | 296 | */ |
| 278 | private boolean isAttributePresent = false; | 297 | private boolean isAttributePresent = false; |
| 298 | + | ||
| 279 | /** | 299 | /** |
| 280 | * Current enum's value. | 300 | * Current enum's value. |
| 281 | */ | 301 | */ |
| 282 | private int enumValue; | 302 | private int enumValue; |
| 303 | + | ||
| 283 | /* | 304 | /* |
| 284 | * Java file handle for enum class. | 305 | * Java file handle for enum class. |
| 285 | */ | 306 | */ |
| 286 | private File enumClassJavaFileHandle; | 307 | private File enumClassJavaFileHandle; |
| 287 | 308 | ||
| 288 | - public TempJavaFragmentFiles() { | ||
| 289 | - } | ||
| 290 | - | ||
| 291 | /** | 309 | /** |
| 292 | * Returns enum class java file handle. | 310 | * Returns enum class java file handle. |
| 293 | * | 311 | * | ... | ... |
| ... | @@ -60,6 +60,7 @@ public class TempJavaTypeFragmentFiles | ... | @@ -60,6 +60,7 @@ public class TempJavaTypeFragmentFiles |
| 60 | * File name for construction for special type like union, typedef. | 60 | * File name for construction for special type like union, typedef. |
| 61 | */ | 61 | */ |
| 62 | private static final String CONSTRUCTOR_FOR_TYPE_FILE_NAME = "ConstructorForType"; | 62 | private static final String CONSTRUCTOR_FOR_TYPE_FILE_NAME = "ConstructorForType"; |
| 63 | + | ||
| 63 | /** | 64 | /** |
| 64 | * File name for from string method. | 65 | * File name for from string method. |
| 65 | */ | 66 | */ |
| ... | @@ -80,6 +81,7 @@ public class TempJavaTypeFragmentFiles | ... | @@ -80,6 +81,7 @@ public class TempJavaTypeFragmentFiles |
| 80 | * Temporary file handle for of string method of class. | 81 | * Temporary file handle for of string method of class. |
| 81 | */ | 82 | */ |
| 82 | private File ofStringImplTempFileHandle; | 83 | private File ofStringImplTempFileHandle; |
| 84 | + | ||
| 83 | /** | 85 | /** |
| 84 | * Temporary file handle for constructor for type class. | 86 | * Temporary file handle for constructor for type class. |
| 85 | */ | 87 | */ |
| ... | @@ -94,6 +96,7 @@ public class TempJavaTypeFragmentFiles | ... | @@ -94,6 +96,7 @@ public class TempJavaTypeFragmentFiles |
| 94 | * Java file handle for typedef class file. | 96 | * Java file handle for typedef class file. |
| 95 | */ | 97 | */ |
| 96 | private File typedefClassJavaFileHandle; | 98 | private File typedefClassJavaFileHandle; |
| 99 | + | ||
| 97 | /** | 100 | /** |
| 98 | * Java file handle for type class like union, typedef file. | 101 | * Java file handle for type class like union, typedef file. |
| 99 | */ | 102 | */ | ... | ... |
| ... | @@ -113,7 +113,7 @@ public class YangJavaNotification | ... | @@ -113,7 +113,7 @@ public class YangJavaNotification |
| 113 | public void generateCodeEntry(YangPluginConfig yangPlugin) | 113 | public void generateCodeEntry(YangPluginConfig yangPlugin) |
| 114 | throws IOException { | 114 | throws IOException { |
| 115 | 115 | ||
| 116 | - /** | 116 | + /* |
| 117 | * As part of the notification support the following files needs to be generated. | 117 | * As part of the notification support the following files needs to be generated. |
| 118 | * 1) Subject of the notification(event), this is simple interface with builder class. | 118 | * 1) Subject of the notification(event), this is simple interface with builder class. |
| 119 | * 2) Event class extending "AbstractEvent" and defining event type enum. | 119 | * 2) Event class extending "AbstractEvent" and defining event type enum. |
| ... | @@ -121,19 +121,18 @@ public class YangJavaNotification | ... | @@ -121,19 +121,18 @@ public class YangJavaNotification |
| 121 | * | 121 | * |
| 122 | * The manager class needs to extend the ListenerRegistry. | 122 | * The manager class needs to extend the ListenerRegistry. |
| 123 | */ | 123 | */ |
| 124 | - | ||
| 125 | - | ||
| 126 | - // Generate subject of the notification(event), this is simple interface with builder class. | ||
| 127 | generateCodeOfNode(this, yangPlugin); | 124 | generateCodeOfNode(this, yangPlugin); |
| 128 | } | 125 | } |
| 129 | 126 | ||
| 130 | /** | 127 | /** |
| 131 | * Creates a java file using the YANG notification info. | 128 | * Creates a java file using the YANG notification info. |
| 129 | + * | ||
| 130 | + * @throws IOException input output operation fail | ||
| 132 | */ | 131 | */ |
| 133 | @Override | 132 | @Override |
| 134 | public void generateCodeExit() | 133 | public void generateCodeExit() |
| 135 | throws IOException { | 134 | throws IOException { |
| 136 | - /** | 135 | + /* |
| 137 | * As part of the notification support the following files needs to be generated. | 136 | * As part of the notification support the following files needs to be generated. |
| 138 | * 1) Subject of the notification(event), this is simple interface with builder class. | 137 | * 1) Subject of the notification(event), this is simple interface with builder class. |
| 139 | * 2) Event class extending "AbstractEvent" and defining event type enum. | 138 | * 2) Event class extending "AbstractEvent" and defining event type enum. | ... | ... |
-
Please register or login to post a comment