Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016 Open Networking Laboratory |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package org.onosproject.yangutils.translator.tojava.utils; |
| 18 | |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 19 | import org.onosproject.yangutils.translator.tojava.AttributeInfo; |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 20 | import org.onosproject.yangutils.utils.UtilConstants; |
| 21 | import org.onosproject.yangutils.utils.io.impl.JavaDocGen; |
| 22 | |
| 23 | /** |
| 24 | * Generated methods for generated files based on the file type. |
| 25 | */ |
| 26 | public final class MethodsGenerator { |
| 27 | |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 28 | /** |
| 29 | * Default constructor. |
| 30 | */ |
| 31 | private MethodsGenerator() { |
| 32 | } |
| 33 | |
| 34 | /** |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 35 | * Returns the methods strings for builder class. |
| 36 | * |
Vinod Kumar S | c421600 | 2016-03-03 19:55:30 +0530 | [diff] [blame^] | 37 | * @param attr attribute info |
| 38 | * @param className java class name |
| 39 | * @return method string for builder class |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 40 | */ |
Vinod Kumar S | c421600 | 2016-03-03 19:55:30 +0530 | [diff] [blame^] | 41 | static String parseBuilderMethodString(AttributeInfo attr, String className) { |
| 42 | String attrQuaifiedType = ""; |
| 43 | if (attr.getImportInfo().getPkgInfo() != null) { |
| 44 | attrQuaifiedType = attr.getImportInfo().getPkgInfo() + "."; |
| 45 | } |
| 46 | attrQuaifiedType = attrQuaifiedType + attr.getImportInfo().getClassInfo(); |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 47 | |
Vinod Kumar S | c421600 | 2016-03-03 19:55:30 +0530 | [diff] [blame^] | 48 | String overrideString = UtilConstants.NEW_LINE + UtilConstants.FOUR_SPACE_INDENTATION |
| 49 | + UtilConstants.OVERRIDE + UtilConstants.NEW_LINE; |
| 50 | String getterString = getGetterForClass(attr.getAttributeName(), attrQuaifiedType); |
| 51 | String setterString = getSetterForClass(attr.getAttributeName(), attrQuaifiedType, className); |
Bharat saraswal | 4bf8b15 | 2016-02-25 02:26:43 +0530 | [diff] [blame] | 52 | return overrideString + getterString + UtilConstants.NEW_LINE + overrideString + setterString; |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 53 | } |
| 54 | |
| 55 | /** |
| 56 | * Returns the methods strings for builder class. |
| 57 | * |
Vinod Kumar S | c421600 | 2016-03-03 19:55:30 +0530 | [diff] [blame^] | 58 | * @param attr attribute info |
| 59 | * @return method string for builder class |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 60 | */ |
Vinod Kumar S | c421600 | 2016-03-03 19:55:30 +0530 | [diff] [blame^] | 61 | static String parseImplMethodString(AttributeInfo attr) { |
| 62 | |
| 63 | String attrQuaifiedType = ""; |
| 64 | if (attr.getImportInfo().getPkgInfo() != null) { |
| 65 | attrQuaifiedType = attr.getImportInfo().getPkgInfo() + "."; |
| 66 | } |
| 67 | attrQuaifiedType = attrQuaifiedType + attr.getImportInfo().getClassInfo(); |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 68 | |
| 69 | return UtilConstants.NEW_LINE + UtilConstants.FOUR_SPACE_INDENTATION + UtilConstants.OVERRIDE |
Vinod Kumar S | c421600 | 2016-03-03 19:55:30 +0530 | [diff] [blame^] | 70 | + UtilConstants.NEW_LINE + getGetterForClass(attr.getAttributeName(), attrQuaifiedType); |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 71 | } |
| 72 | |
| 73 | /** |
| 74 | * Returns the methods strings for builder interface. |
| 75 | * |
Vinod Kumar S | c421600 | 2016-03-03 19:55:30 +0530 | [diff] [blame^] | 76 | * @param attr attribute info |
| 77 | * @param className name of the java class being generated |
| 78 | * @return method string for builder interface |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 79 | */ |
Vinod Kumar S | c421600 | 2016-03-03 19:55:30 +0530 | [diff] [blame^] | 80 | static String parseBuilderInterfaceMethodString(AttributeInfo attr, String className) { |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 81 | |
Vinod Kumar S | c421600 | 2016-03-03 19:55:30 +0530 | [diff] [blame^] | 82 | return getGetterString(attr) + UtilConstants.NEW_LINE + getSetterString(attr, className); |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 83 | } |
| 84 | |
| 85 | /** |
| 86 | * Returns the methods strings for builder interface. |
| 87 | * |
Vinod Kumar S | c421600 | 2016-03-03 19:55:30 +0530 | [diff] [blame^] | 88 | * @param name attribute name |
| 89 | * @return method string for builder interface |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 90 | */ |
| 91 | public static String parseBuilderInterfaceBuildMethodString(String name) { |
| 92 | |
Vinod Kumar S | c421600 | 2016-03-03 19:55:30 +0530 | [diff] [blame^] | 93 | return JavaDocGen.getJavaDoc(JavaDocGen.JavaDocType.BUILD, name) |
| 94 | + getBuildForInterface(name); |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 95 | } |
| 96 | |
| 97 | /** |
| 98 | * Returns getter string. |
| 99 | * |
Vinod Kumar S | c421600 | 2016-03-03 19:55:30 +0530 | [diff] [blame^] | 100 | * @param attr attribute info |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 101 | * @return getter string |
| 102 | */ |
| 103 | public static String getGetterString(AttributeInfo attr) { |
| 104 | |
Vinod Kumar S | c421600 | 2016-03-03 19:55:30 +0530 | [diff] [blame^] | 105 | String returnType = ""; |
| 106 | if (attr.getImportInfo().getPkgInfo() != null) { |
| 107 | returnType = attr.getImportInfo().getPkgInfo() + "."; |
| 108 | } |
| 109 | |
| 110 | returnType = returnType + attr.getImportInfo().getClassInfo(); |
| 111 | |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 112 | return JavaDocGen.getJavaDoc(JavaDocGen.JavaDocType.GETTER, attr.getAttributeName()) |
Vinod Kumar S | c421600 | 2016-03-03 19:55:30 +0530 | [diff] [blame^] | 113 | + getGetterForInterface(attr.getAttributeName(), returnType) |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 114 | + UtilConstants.NEW_LINE; |
| 115 | } |
| 116 | |
| 117 | /** |
| 118 | * Returns setter string. |
| 119 | * |
Vinod Kumar S | c421600 | 2016-03-03 19:55:30 +0530 | [diff] [blame^] | 120 | * @param attr attribute info |
| 121 | * @param className java class name |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 122 | * @return setter string |
| 123 | */ |
Vinod Kumar S | c421600 | 2016-03-03 19:55:30 +0530 | [diff] [blame^] | 124 | private static String getSetterString(AttributeInfo attr, String className) { |
| 125 | |
| 126 | String attrType = ""; |
| 127 | if (attr.getImportInfo().getPkgInfo() != null) { |
| 128 | attrType = attr.getImportInfo().getPkgInfo() + "."; |
| 129 | } |
| 130 | |
| 131 | attrType = attrType + attr.getImportInfo().getClassInfo(); |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 132 | |
| 133 | return JavaDocGen.getJavaDoc(JavaDocGen.JavaDocType.SETTER, attr.getAttributeName()) |
Vinod Kumar S | c421600 | 2016-03-03 19:55:30 +0530 | [diff] [blame^] | 134 | + getSetterForInterface(attr.getAttributeName(), attrType, className); |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 135 | } |
| 136 | |
| 137 | /** |
| 138 | * Returns constructor method string. |
| 139 | * |
| 140 | * @param name class name |
| 141 | * @return constructor string |
| 142 | */ |
| 143 | public static String getConstructorString(String name) { |
| 144 | |
Vinod Kumar S | c421600 | 2016-03-03 19:55:30 +0530 | [diff] [blame^] | 145 | return JavaDocGen.getJavaDoc(JavaDocGen.JavaDocType.CONSTRUCTOR, name) |
| 146 | + getConstructor(name); |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 147 | } |
| 148 | |
| 149 | /** |
| 150 | * Returns default constructor method string. |
| 151 | * |
| 152 | * @param type generated file type |
| 153 | * @param name class name |
| 154 | * @return default constructor string |
| 155 | */ |
Vinod Kumar S | c421600 | 2016-03-03 19:55:30 +0530 | [diff] [blame^] | 156 | public static String getDefaultConstructorString(int type, String name) { |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 157 | |
| 158 | return JavaDocGen.getJavaDoc(JavaDocGen.JavaDocType.DEFAULT_CONSTRUCTOR, name) |
Vinod Kumar S | c421600 | 2016-03-03 19:55:30 +0530 | [diff] [blame^] | 159 | + getDefaultConstructor(name + UtilConstants.BUILDER); |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 160 | } |
| 161 | |
| 162 | /** |
| 163 | * Returns build method string. |
| 164 | * |
| 165 | * @param name class name |
| 166 | * @return build string |
| 167 | */ |
| 168 | public static String getBuildString(String name) { |
| 169 | |
| 170 | return UtilConstants.FOUR_SPACE_INDENTATION + UtilConstants.OVERRIDE + UtilConstants.NEW_LINE |
Vinod Kumar S | c421600 | 2016-03-03 19:55:30 +0530 | [diff] [blame^] | 171 | + getBuild(name); |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 172 | } |
| 173 | |
| 174 | /** |
| 175 | * Returns the getter method strings for class file. |
| 176 | * |
Vinod Kumar S | c421600 | 2016-03-03 19:55:30 +0530 | [diff] [blame^] | 177 | * @param attrName name of the attribute |
| 178 | * @param attrType return type of attribute |
| 179 | * @return getter method for class |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 180 | */ |
Vinod Kumar S | c421600 | 2016-03-03 19:55:30 +0530 | [diff] [blame^] | 181 | private static String getGetterForClass(String attrName, String attrType) { |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 182 | |
| 183 | return UtilConstants.FOUR_SPACE_INDENTATION + UtilConstants.PUBLIC + UtilConstants.SPACE |
Vinod Kumar S | c421600 | 2016-03-03 19:55:30 +0530 | [diff] [blame^] | 184 | + attrType + UtilConstants.SPACE + UtilConstants.GET_METHOD_PREFIX |
| 185 | + JavaIdentifierSyntax.getCaptialCase(attrName) + UtilConstants.OPEN_PARENTHESIS |
| 186 | + UtilConstants.CLOSE_PARENTHESIS + UtilConstants.SPACE + UtilConstants.OPEN_CURLY_BRACKET |
| 187 | + UtilConstants.NEW_LINE + UtilConstants.EIGHT_SPACE_INDENTATION + UtilConstants.RETURN |
| 188 | + UtilConstants.SPACE + attrName + UtilConstants.SEMI_COLAN + UtilConstants.NEW_LINE |
| 189 | + UtilConstants.FOUR_SPACE_INDENTATION + UtilConstants.CLOSE_CURLY_BRACKET; |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 190 | } |
| 191 | |
| 192 | /** |
| 193 | * Returns the setter method strings for class file. |
| 194 | * |
Vinod Kumar S | c421600 | 2016-03-03 19:55:30 +0530 | [diff] [blame^] | 195 | * @param attrName name of the attribute |
| 196 | * @param attrType return type of attribute |
| 197 | * @param className name of the class |
| 198 | * @return setter method for class |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 199 | */ |
Vinod Kumar S | c421600 | 2016-03-03 19:55:30 +0530 | [diff] [blame^] | 200 | private static String getSetterForClass(String attrName, String attrType, String className) { |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 201 | |
Vinod Kumar S | c421600 | 2016-03-03 19:55:30 +0530 | [diff] [blame^] | 202 | return UtilConstants.FOUR_SPACE_INDENTATION + UtilConstants.PUBLIC + UtilConstants.SPACE |
| 203 | + className + UtilConstants.BUILDER + UtilConstants.SPACE + UtilConstants.SET_METHOD_PREFIX |
| 204 | + JavaIdentifierSyntax.getCaptialCase(attrName) + UtilConstants.OPEN_PARENTHESIS |
| 205 | + attrType + UtilConstants.SPACE + attrName + UtilConstants.CLOSE_PARENTHESIS |
| 206 | + UtilConstants.SPACE + UtilConstants.OPEN_CURLY_BRACKET + UtilConstants.NEW_LINE |
| 207 | + UtilConstants.EIGHT_SPACE_INDENTATION + UtilConstants.THIS + UtilConstants.PERIOD |
| 208 | + attrName + UtilConstants.SPACE + UtilConstants.EQUAL + UtilConstants.SPACE + attrName |
| 209 | + UtilConstants.SEMI_COLAN + UtilConstants.NEW_LINE + UtilConstants.EIGHT_SPACE_INDENTATION |
| 210 | + UtilConstants.RETURN + UtilConstants.SPACE + UtilConstants.THIS + UtilConstants.SEMI_COLAN |
| 211 | + UtilConstants.NEW_LINE + UtilConstants.FOUR_SPACE_INDENTATION + UtilConstants.CLOSE_CURLY_BRACKET; |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 212 | } |
| 213 | |
| 214 | /** |
| 215 | * Returns the getter method strings for interface file. |
| 216 | * |
Vinod Kumar S | c421600 | 2016-03-03 19:55:30 +0530 | [diff] [blame^] | 217 | * @param yangName name of the attribute |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 218 | * @param returnType return type of attribute |
Vinod Kumar S | c421600 | 2016-03-03 19:55:30 +0530 | [diff] [blame^] | 219 | * @return getter method for interface |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 220 | */ |
Vinod Kumar S | c421600 | 2016-03-03 19:55:30 +0530 | [diff] [blame^] | 221 | private static String getGetterForInterface(String yangName, String returnType) { |
| 222 | return UtilConstants.FOUR_SPACE_INDENTATION + returnType |
| 223 | + UtilConstants.SPACE + UtilConstants.GET_METHOD_PREFIX |
| 224 | + JavaIdentifierSyntax.getCaptialCase(yangName) |
| 225 | + UtilConstants.OPEN_PARENTHESIS + UtilConstants.CLOSE_PARENTHESIS |
| 226 | + UtilConstants.SEMI_COLAN; |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 227 | } |
| 228 | |
| 229 | /** |
| 230 | * Returns the setter method strings for interface file. |
| 231 | * |
Vinod Kumar S | c421600 | 2016-03-03 19:55:30 +0530 | [diff] [blame^] | 232 | * @param attrName name of the attribute |
| 233 | * @param attrType return type of attribute |
| 234 | * @param className name of the java class being generated |
| 235 | * @return setter method for interface |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 236 | */ |
Vinod Kumar S | c421600 | 2016-03-03 19:55:30 +0530 | [diff] [blame^] | 237 | private static String getSetterForInterface(String attrName, String attrType, String className) { |
| 238 | return UtilConstants.FOUR_SPACE_INDENTATION + className + UtilConstants.BUILDER |
| 239 | + UtilConstants.SPACE + UtilConstants.SET_METHOD_PREFIX |
| 240 | + JavaIdentifierSyntax.getCaptialCase(attrName) + UtilConstants.OPEN_PARENTHESIS |
| 241 | + attrType + UtilConstants.SPACE + attrName + UtilConstants.CLOSE_PARENTHESIS |
| 242 | + UtilConstants.SEMI_COLAN; |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 243 | } |
| 244 | |
| 245 | /** |
| 246 | * Returns the build method strings for interface file. |
| 247 | * |
Vinod Kumar S | c421600 | 2016-03-03 19:55:30 +0530 | [diff] [blame^] | 248 | * @param yangName name of the interface |
| 249 | * @return build method for interface |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 250 | */ |
| 251 | private static String getBuildForInterface(String yangName) { |
| 252 | |
| 253 | return UtilConstants.FOUR_SPACE_INDENTATION + yangName + UtilConstants.SPACE + UtilConstants.BUILD |
| 254 | + UtilConstants.OPEN_PARENTHESIS + UtilConstants.CLOSE_PARENTHESIS + UtilConstants.SEMI_COLAN; |
| 255 | } |
| 256 | |
| 257 | /** |
| 258 | * Returns the constructor strings for class file. |
| 259 | * |
Vinod Kumar S | c421600 | 2016-03-03 19:55:30 +0530 | [diff] [blame^] | 260 | * @param yangName name of the class |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 261 | * @return constructor for class |
| 262 | */ |
| 263 | private static String getConstructor(String yangName) { |
| 264 | |
Vinod Kumar S | c421600 | 2016-03-03 19:55:30 +0530 | [diff] [blame^] | 265 | String builderAttribute = yangName.substring(0, 1).toLowerCase() + yangName.substring(1); |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 266 | String constructor = UtilConstants.FOUR_SPACE_INDENTATION + UtilConstants.PUBLIC + UtilConstants.SPACE |
| 267 | + yangName + UtilConstants.IMPL + UtilConstants.OPEN_PARENTHESIS + yangName + UtilConstants.BUILDER |
| 268 | + UtilConstants.SPACE + builderAttribute + UtilConstants.OBJECT + UtilConstants.CLOSE_PARENTHESIS |
| 269 | + UtilConstants.SPACE + UtilConstants.OPEN_CURLY_BRACKET + UtilConstants.NEW_LINE; |
| 270 | |
Vinod Kumar S | c421600 | 2016-03-03 19:55:30 +0530 | [diff] [blame^] | 271 | // TODO: need to get the partial constructor from constructor temp file. |
| 272 | // if (getAttrInfo() != null) { |
| 273 | // for (AttributeInfo attribute : getAttrInfo()) { |
| 274 | // attribute.setAttributeName(JavaIdentifierSyntax.getCamelCase(attribute.getAttributeName())); |
| 275 | // constructor = constructor + UtilConstants.TWELVE_SPACE_INDENTATION + UtilConstants.THIS |
| 276 | // + UtilConstants.PERIOD + attribute.getAttributeName() + UtilConstants.SPACE |
| 277 | // + UtilConstants.EQUAL + UtilConstants.SPACE + builderAttribute + UtilConstants.OBJECT |
| 278 | // + UtilConstants.PERIOD + UtilConstants.GET_METHOD_PREFIX |
| 279 | // + JavaIdentifierSyntax.getCaptialCase(attribute.getAttributeName()) |
| 280 | // + UtilConstants.OPEN_PARENTHESIS |
| 281 | // + UtilConstants.CLOSE_PARENTHESIS + UtilConstants.SEMI_COLAN |
| 282 | // + UtilConstants.NEW_LINE; |
| 283 | // } |
| 284 | // getAttrInfo().clear(); |
| 285 | // } |
| 286 | |
Bharat saraswal | 4bf8b15 | 2016-02-25 02:26:43 +0530 | [diff] [blame] | 287 | return constructor + UtilConstants.FOUR_SPACE_INDENTATION + UtilConstants.CLOSE_CURLY_BRACKET; |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 288 | } |
| 289 | |
| 290 | /** |
| 291 | * Returns the build method strings for class file. |
| 292 | * |
| 293 | * @param yangName class name |
Vinod Kumar S | c421600 | 2016-03-03 19:55:30 +0530 | [diff] [blame^] | 294 | * @return build method string for class |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 295 | */ |
| 296 | private static String getBuild(String yangName) { |
| 297 | |
| 298 | return UtilConstants.FOUR_SPACE_INDENTATION + UtilConstants.PUBLIC + UtilConstants.SPACE + yangName |
| 299 | + UtilConstants.SPACE + UtilConstants.BUILD + UtilConstants.OPEN_PARENTHESIS |
| 300 | + UtilConstants.CLOSE_PARENTHESIS + UtilConstants.SPACE + UtilConstants.OPEN_CURLY_BRACKET |
| 301 | + UtilConstants.NEW_LINE + UtilConstants.EIGHT_SPACE_INDENTATION + UtilConstants.RETURN |
| 302 | + UtilConstants.SPACE + UtilConstants.NEW + UtilConstants.SPACE + yangName + UtilConstants.IMPL |
| 303 | + UtilConstants.OPEN_PARENTHESIS + UtilConstants.THIS + UtilConstants.CLOSE_PARENTHESIS |
| 304 | + UtilConstants.SEMI_COLAN + UtilConstants.NEW_LINE + UtilConstants.FOUR_SPACE_INDENTATION |
| 305 | + UtilConstants.CLOSE_CURLY_BRACKET; |
| 306 | } |
| 307 | |
| 308 | /** |
| 309 | * Returns the Default constructor strings for class file. |
| 310 | * |
Vinod Kumar S | c421600 | 2016-03-03 19:55:30 +0530 | [diff] [blame^] | 311 | * @param name name of the class |
Bharat saraswal | 870c56f | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 312 | * @return Default constructor for class |
| 313 | */ |
| 314 | private static String getDefaultConstructor(String name) { |
| 315 | |
| 316 | return UtilConstants.FOUR_SPACE_INDENTATION + UtilConstants.PUBLIC + UtilConstants.SPACE + name |
| 317 | + UtilConstants.OPEN_PARENTHESIS + UtilConstants.CLOSE_PARENTHESIS + UtilConstants.SPACE |
| 318 | + UtilConstants.OPEN_CURLY_BRACKET + UtilConstants.NEW_LINE + UtilConstants.FOUR_SPACE_INDENTATION |
| 319 | + UtilConstants.CLOSE_CURLY_BRACKET + UtilConstants.NEW_LINE; |
| 320 | } |
| 321 | |
| 322 | } |