Vinod Kumar S | 79a374b | 2016-04-30 21:09:15 +0530 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016-present 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; |
| 18 | |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 19 | import java.io.File; |
Vinod Kumar S | 79a374b | 2016-04-30 21:09:15 +0530 | [diff] [blame] | 20 | import java.io.IOException; |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 21 | import java.util.ArrayList; |
| 22 | import java.util.List; |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 23 | import org.onosproject.yangutils.datamodel.YangNode; |
| 24 | import org.onosproject.yangutils.datamodel.YangType; |
| 25 | import org.onosproject.yangutils.datamodel.YangTypeHolder; |
Bharat saraswal | 64e7e23 | 2016-07-14 23:33:55 +0530 | [diff] [blame] | 26 | import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes; |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 27 | import org.onosproject.yangutils.translator.exception.TranslatorException; |
Shankara-Huawei | b756477 | 2016-08-02 18:13:13 +0530 | [diff] [blame] | 28 | import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaTypeTranslator; |
Gaurav Agrawal | 8a14752 | 2016-08-10 13:43:01 +0530 | [diff] [blame^] | 29 | import org.onosproject.yangutils.utils.io.YangPluginConfig; |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 30 | |
Bharat saraswal | 64e7e23 | 2016-07-14 23:33:55 +0530 | [diff] [blame] | 31 | import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.INT32; |
| 32 | import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.INT64; |
| 33 | import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.UINT16; |
| 34 | import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.UINT32; |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 35 | import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_TYPEDEF_CLASS; |
| 36 | import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_UNION_CLASS; |
| 37 | import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.CONSTRUCTOR_FOR_TYPE_MASK; |
| 38 | import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.FROM_STRING_IMPL_MASK; |
| 39 | import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.OF_STRING_IMPL_MASK; |
| 40 | import static org.onosproject.yangutils.translator.tojava.JavaAttributeInfo.getAttributeInfoForTheData; |
Shankara-Huawei | b756477 | 2016-08-02 18:13:13 +0530 | [diff] [blame] | 41 | import static org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfoTranslator.getQualifiedInfoOfFromString; |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 42 | import static org.onosproject.yangutils.translator.tojava.utils.JavaFileGenerator.generateTypeDefClassFile; |
| 43 | import static org.onosproject.yangutils.translator.tojava.utils.JavaFileGenerator.generateUnionClassFile; |
Bharat saraswal | 64e7e23 | 2016-07-14 23:33:55 +0530 | [diff] [blame] | 44 | import static org.onosproject.yangutils.translator.tojava.utils.JavaIdentifierSyntax.createPackage; |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 45 | import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getOfMethodStringAndJavaDoc; |
| 46 | import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getTypeConstructorStringAndJavaDoc; |
Bharat saraswal | 64e7e23 | 2016-07-14 23:33:55 +0530 | [diff] [blame] | 47 | import static org.onosproject.yangutils.translator.tojava.utils.ValidatorTypeForUnionTypes.INT_TYPE_CONFLICT; |
| 48 | import static org.onosproject.yangutils.translator.tojava.utils.ValidatorTypeForUnionTypes.LONG_TYPE_CONFLICT; |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 49 | import static org.onosproject.yangutils.utils.UtilConstants.EMPTY_STRING; |
| 50 | import static org.onosproject.yangutils.utils.UtilConstants.NEW_LINE; |
Bharat saraswal | 64e7e23 | 2016-07-14 23:33:55 +0530 | [diff] [blame] | 51 | import static org.onosproject.yangutils.utils.io.impl.FileSystemUtil.closeFile; |
| 52 | import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getCamelCase; |
Vinod Kumar S | 79a374b | 2016-04-30 21:09:15 +0530 | [diff] [blame] | 53 | |
| 54 | /** |
Bharat saraswal | 64e7e23 | 2016-07-14 23:33:55 +0530 | [diff] [blame] | 55 | * Represents implementation of java data type code fragments temporary implementations. Maintains the temp files |
| 56 | * required specific for user defined data type java snippet generation. |
Vinod Kumar S | 79a374b | 2016-04-30 21:09:15 +0530 | [diff] [blame] | 57 | */ |
| 58 | public class TempJavaTypeFragmentFiles |
| 59 | extends TempJavaFragmentFiles { |
| 60 | |
| 61 | /** |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 62 | * File name for of string method. |
| 63 | */ |
| 64 | private static final String OF_STRING_METHOD_FILE_NAME = "OfString"; |
| 65 | |
| 66 | /** |
| 67 | * File name for construction for special type like union, typedef. |
| 68 | */ |
| 69 | private static final String CONSTRUCTOR_FOR_TYPE_FILE_NAME = "ConstructorForType"; |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 70 | |
| 71 | /** |
| 72 | * File name for typedef class file name suffix. |
| 73 | */ |
| 74 | private static final String TYPEDEF_CLASS_FILE_NAME_SUFFIX = EMPTY_STRING; |
| 75 | |
| 76 | /** |
Bharat saraswal | 64e7e23 | 2016-07-14 23:33:55 +0530 | [diff] [blame] | 77 | * File name for generated class file for special type like union, typedef suffix. |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 78 | */ |
| 79 | private static final String UNION_TYPE_CLASS_FILE_NAME_SUFFIX = EMPTY_STRING; |
| 80 | |
| 81 | /** |
Bharat saraswal | 64e7e23 | 2016-07-14 23:33:55 +0530 | [diff] [blame] | 82 | * Integer index in type list. |
| 83 | */ |
| 84 | private int intIndex = 0; |
| 85 | |
| 86 | /** |
| 87 | * UInt index in type list. |
| 88 | */ |
| 89 | private int uIntIndex = 0; |
| 90 | |
| 91 | /** |
| 92 | * long index in type list. |
| 93 | */ |
| 94 | private int longIndex = 0; |
| 95 | |
| 96 | /** |
| 97 | * ULong index in type list. |
| 98 | */ |
| 99 | private int uLongIndex = 0; |
| 100 | |
| 101 | /** |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 102 | * Temporary file handle for of string method of class. |
| 103 | */ |
| 104 | private File ofStringImplTempFileHandle; |
VinodKumarS-Huawei | d81eccb | 2016-06-01 14:30:22 +0530 | [diff] [blame] | 105 | |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 106 | /** |
| 107 | * Temporary file handle for constructor for type class. |
| 108 | */ |
| 109 | private File constructorForTypeTempFileHandle; |
| 110 | |
| 111 | /** |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 112 | * Java file handle for typedef class file. |
| 113 | */ |
| 114 | private File typedefClassJavaFileHandle; |
VinodKumarS-Huawei | d81eccb | 2016-06-01 14:30:22 +0530 | [diff] [blame] | 115 | |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 116 | /** |
| 117 | * Java file handle for type class like union, typedef file. |
| 118 | */ |
| 119 | private File typeClassJavaFileHandle; |
| 120 | |
| 121 | /** |
Bharat saraswal | 64e7e23 | 2016-07-14 23:33:55 +0530 | [diff] [blame] | 122 | * Java attribute for int. |
| 123 | */ |
| 124 | private JavaAttributeInfo intAttribute; |
| 125 | |
| 126 | /** |
| 127 | * Java attribute for long. |
| 128 | */ |
| 129 | private JavaAttributeInfo longAttribute; |
| 130 | |
| 131 | /** |
| 132 | * Java attribute for uInt. |
| 133 | */ |
| 134 | private JavaAttributeInfo uIntAttribute; |
| 135 | |
| 136 | /** |
| 137 | * Java attribute for uLong. |
| 138 | */ |
| 139 | private JavaAttributeInfo uLongAttribute; |
| 140 | |
| 141 | /** |
Vinod Kumar S | 79a374b | 2016-04-30 21:09:15 +0530 | [diff] [blame] | 142 | * Creates an instance of temporary java code fragment. |
| 143 | * |
| 144 | * @param javaFileInfo generated java file info |
| 145 | * @throws IOException when fails to create new file handle |
| 146 | */ |
Bharat saraswal | e50edca | 2016-08-05 01:58:25 +0530 | [diff] [blame] | 147 | TempJavaTypeFragmentFiles(JavaFileInfoTranslator javaFileInfo) |
Vinod Kumar S | 79a374b | 2016-04-30 21:09:15 +0530 | [diff] [blame] | 148 | throws IOException { |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 149 | |
Vinod Kumar S | 79a374b | 2016-04-30 21:09:15 +0530 | [diff] [blame] | 150 | super(javaFileInfo); |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 151 | |
| 152 | /* |
| 153 | * Initialize getterImpl, attributes, hash code, equals and to strings |
| 154 | * when generation file type matches to typeDef class mask. |
| 155 | */ |
| 156 | addGeneratedTempFile(OF_STRING_IMPL_MASK); |
| 157 | addGeneratedTempFile(CONSTRUCTOR_FOR_TYPE_MASK); |
| 158 | addGeneratedTempFile(FROM_STRING_IMPL_MASK); |
| 159 | |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 160 | setOfStringImplTempFileHandle(getTemporaryFileHandle(OF_STRING_METHOD_FILE_NAME)); |
| 161 | setConstructorForTypeTempFileHandle(getTemporaryFileHandle(CONSTRUCTOR_FOR_TYPE_FILE_NAME)); |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 162 | |
Vinod Kumar S | 79a374b | 2016-04-30 21:09:15 +0530 | [diff] [blame] | 163 | } |
| 164 | |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 165 | /** |
| 166 | * Returns type class constructor method's temporary file handle. |
| 167 | * |
| 168 | * @return type class constructor method's temporary file handle |
| 169 | */ |
| 170 | |
| 171 | public File getConstructorForTypeTempFileHandle() { |
| 172 | return constructorForTypeTempFileHandle; |
| 173 | } |
| 174 | |
| 175 | /** |
| 176 | * Sets type class constructor method's temporary file handle. |
| 177 | * |
Bharat saraswal | 64e7e23 | 2016-07-14 23:33:55 +0530 | [diff] [blame] | 178 | * @param constructorForTypeTempFileHandle type class constructor method's temporary file handle |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 179 | */ |
| 180 | private void setConstructorForTypeTempFileHandle(File constructorForTypeTempFileHandle) { |
| 181 | this.constructorForTypeTempFileHandle = constructorForTypeTempFileHandle; |
| 182 | } |
| 183 | |
| 184 | /** |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 185 | * Returns java file handle for typedef class file. |
| 186 | * |
| 187 | * @return java file handle for typedef class file |
| 188 | */ |
Bharat saraswal | 64e7e23 | 2016-07-14 23:33:55 +0530 | [diff] [blame] | 189 | private File getTypedefClassJavaFileHandle() { |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 190 | return typedefClassJavaFileHandle; |
| 191 | } |
| 192 | |
| 193 | /** |
| 194 | * Sets the java file handle for typedef class file. |
| 195 | * |
| 196 | * @param typedefClassJavaFileHandle java file handle |
| 197 | */ |
| 198 | private void setTypedefClassJavaFileHandle(File typedefClassJavaFileHandle) { |
| 199 | this.typedefClassJavaFileHandle = typedefClassJavaFileHandle; |
| 200 | } |
| 201 | |
| 202 | /** |
| 203 | * Returns java file handle for type class file. |
| 204 | * |
| 205 | * @return java file handle for type class file |
| 206 | */ |
Bharat saraswal | 64e7e23 | 2016-07-14 23:33:55 +0530 | [diff] [blame] | 207 | private File getTypeClassJavaFileHandle() { |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 208 | return typeClassJavaFileHandle; |
| 209 | } |
| 210 | |
| 211 | /** |
| 212 | * Sets the java file handle for type class file. |
| 213 | * |
| 214 | * @param typeClassJavaFileHandle type file handle |
| 215 | */ |
| 216 | private void setTypeClassJavaFileHandle(File typeClassJavaFileHandle) { |
| 217 | this.typeClassJavaFileHandle = typeClassJavaFileHandle; |
| 218 | } |
| 219 | |
| 220 | /** |
| 221 | * Returns of string method's temporary file handle. |
| 222 | * |
| 223 | * @return of string method's temporary file handle |
| 224 | */ |
| 225 | |
| 226 | public File getOfStringImplTempFileHandle() { |
| 227 | return ofStringImplTempFileHandle; |
| 228 | } |
| 229 | |
| 230 | /** |
| 231 | * Set of string method's temporary file handle. |
| 232 | * |
Bharat saraswal | 64e7e23 | 2016-07-14 23:33:55 +0530 | [diff] [blame] | 233 | * @param ofStringImplTempFileHandle of string method's temporary file handle |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 234 | */ |
| 235 | private void setOfStringImplTempFileHandle(File ofStringImplTempFileHandle) { |
| 236 | this.ofStringImplTempFileHandle = ofStringImplTempFileHandle; |
| 237 | } |
| 238 | |
| 239 | /** |
Bharat saraswal | 64e7e23 | 2016-07-14 23:33:55 +0530 | [diff] [blame] | 240 | * Adds all the type in the current data model node as part of the generated temporary file. |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 241 | * |
Bharat saraswal | 64e7e23 | 2016-07-14 23:33:55 +0530 | [diff] [blame] | 242 | * @param yangTypeHolder YANG java data model node which has type info, eg union / typedef |
| 243 | * @param pluginConfig plugin configurations for naming conventions |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 244 | * @throws IOException IO operation fail |
| 245 | */ |
Bharat saraswal | 64e7e23 | 2016-07-14 23:33:55 +0530 | [diff] [blame] | 246 | void addTypeInfoToTempFiles(YangTypeHolder yangTypeHolder, YangPluginConfig pluginConfig) |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 247 | throws IOException { |
| 248 | |
| 249 | List<YangType<?>> typeList = yangTypeHolder.getTypeList(); |
| 250 | if (typeList != null) { |
| 251 | for (YangType<?> yangType : typeList) { |
Shankara-Huawei | b756477 | 2016-08-02 18:13:13 +0530 | [diff] [blame] | 252 | if (!(yangType instanceof YangJavaTypeTranslator)) { |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 253 | throw new TranslatorException("Type does not have Java info"); |
| 254 | } |
Bharat saraswal | 64e7e23 | 2016-07-14 23:33:55 +0530 | [diff] [blame] | 255 | JavaAttributeInfo javaAttributeInfo = getAttributeForType(yangType, pluginConfig); |
| 256 | addJavaSnippetInfoToApplicableTempFiles(javaAttributeInfo, |
| 257 | pluginConfig, typeList); |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 258 | } |
Bharat saraswal | 64e7e23 | 2016-07-14 23:33:55 +0530 | [diff] [blame] | 259 | addTypeConstructor(pluginConfig); |
| 260 | addMethodsInConflictCase(pluginConfig); |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 261 | } |
| 262 | } |
| 263 | |
| 264 | /** |
Bharat saraswal | 64e7e23 | 2016-07-14 23:33:55 +0530 | [diff] [blame] | 265 | * Returns java attribute. |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 266 | * |
Bharat saraswal | 64e7e23 | 2016-07-14 23:33:55 +0530 | [diff] [blame] | 267 | * @param yangType YANG type |
Bharat saraswal | 715d3fc | 2016-05-17 19:59:16 +0530 | [diff] [blame] | 268 | * @param pluginConfig plugin configurations |
Bharat saraswal | 64e7e23 | 2016-07-14 23:33:55 +0530 | [diff] [blame] | 269 | * @return java attribute |
| 270 | */ |
| 271 | private JavaAttributeInfo getAttributeForType(YangType yangType, YangPluginConfig pluginConfig) { |
Shankara-Huawei | b756477 | 2016-08-02 18:13:13 +0530 | [diff] [blame] | 272 | YangJavaTypeTranslator<?> javaType = (YangJavaTypeTranslator<?>) yangType; |
Bharat saraswal | 64e7e23 | 2016-07-14 23:33:55 +0530 | [diff] [blame] | 273 | javaType.updateJavaQualifiedInfo(pluginConfig.getConflictResolver()); |
| 274 | String typeName = javaType.getDataTypeName(); |
| 275 | typeName = getCamelCase(typeName, pluginConfig.getConflictResolver()); |
| 276 | return getAttributeInfoForTheData( |
| 277 | javaType.getJavaQualifiedInfo(), |
| 278 | typeName, javaType, |
| 279 | getIsQualifiedAccessOrAddToImportList(javaType.getJavaQualifiedInfo()), |
| 280 | false); |
| 281 | } |
| 282 | |
| 283 | /** |
| 284 | * Adds the new attribute info to the target generated temporary files for union class. |
| 285 | * |
| 286 | * @param javaAttributeInfo the attribute info that needs to be added to temporary files |
| 287 | * @param pluginConfig plugin configurations |
| 288 | * @param typeList type list |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 289 | * @throws IOException IO operation fail |
| 290 | */ |
Bharat saraswal | 64e7e23 | 2016-07-14 23:33:55 +0530 | [diff] [blame] | 291 | private void addJavaSnippetInfoToApplicableTempFiles(JavaAttributeInfo javaAttributeInfo, |
| 292 | YangPluginConfig pluginConfig, List<YangType<?>> typeList) |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 293 | throws IOException { |
| 294 | |
Bharat saraswal | 64e7e23 | 2016-07-14 23:33:55 +0530 | [diff] [blame] | 295 | YangDataTypes attrType = javaAttributeInfo.getAttributeType().getDataType(); |
| 296 | |
| 297 | if (attrType == INT32 || attrType == UINT16) { |
| 298 | boolean isIntConflict = validateForConflictingIntTypes(typeList); |
| 299 | javaAttributeInfo.setIntConflict(isIntConflict); |
| 300 | updateAttributeCondition(javaAttributeInfo); |
| 301 | if (!isIntConflict) { |
| 302 | addMethodsWhenNoConflictingTypes(javaAttributeInfo, pluginConfig); |
| 303 | } |
| 304 | } else if (attrType == INT64 || attrType == UINT32) { |
| 305 | boolean isLongConflict = validateForConflictingLongTypes(typeList); |
| 306 | javaAttributeInfo.setLongConflict(isLongConflict); |
| 307 | updateAttributeCondition(javaAttributeInfo); |
| 308 | if (!isLongConflict) { |
| 309 | addMethodsWhenNoConflictingTypes(javaAttributeInfo, pluginConfig); |
| 310 | } |
| 311 | } else { |
| 312 | addMethodsWhenNoConflictingTypes(javaAttributeInfo, pluginConfig); |
| 313 | } |
Bharat saraswal | 715d3fc | 2016-05-17 19:59:16 +0530 | [diff] [blame] | 314 | super.addJavaSnippetInfoToApplicableTempFiles(javaAttributeInfo, pluginConfig); |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 315 | |
Bharat saraswal | 64e7e23 | 2016-07-14 23:33:55 +0530 | [diff] [blame] | 316 | } |
| 317 | |
| 318 | /** |
Shankara-Huawei | b756477 | 2016-08-02 18:13:13 +0530 | [diff] [blame] | 319 | * Adds of method and constructor when there is no conflicting types. |
Bharat saraswal | 64e7e23 | 2016-07-14 23:33:55 +0530 | [diff] [blame] | 320 | * |
| 321 | * @param javaAttributeInfo java attribute info |
| 322 | * @param pluginConfig plugin configurations |
Shankara-Huawei | b756477 | 2016-08-02 18:13:13 +0530 | [diff] [blame] | 323 | * @throws IOException when fails to do IO operations |
Bharat saraswal | 64e7e23 | 2016-07-14 23:33:55 +0530 | [diff] [blame] | 324 | */ |
| 325 | private void addMethodsWhenNoConflictingTypes(JavaAttributeInfo javaAttributeInfo, |
| 326 | YangPluginConfig pluginConfig) throws IOException { |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 327 | if ((getGeneratedTempFiles() & OF_STRING_IMPL_MASK) != 0) { |
Bharat saraswal | 715d3fc | 2016-05-17 19:59:16 +0530 | [diff] [blame] | 328 | addOfStringMethod(javaAttributeInfo, pluginConfig); |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 329 | } |
Bharat saraswal | 64e7e23 | 2016-07-14 23:33:55 +0530 | [diff] [blame] | 330 | |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 331 | if ((getGeneratedTempFiles() & CONSTRUCTOR_FOR_TYPE_MASK) != 0) { |
Bharat saraswal | 715d3fc | 2016-05-17 19:59:16 +0530 | [diff] [blame] | 332 | addTypeConstructor(javaAttributeInfo, pluginConfig); |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 333 | } |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 334 | } |
| 335 | |
| 336 | /** |
Bharat saraswal | 64e7e23 | 2016-07-14 23:33:55 +0530 | [diff] [blame] | 337 | * Adds of, getter and from string method in conflict cases. |
| 338 | * |
| 339 | * @param pluginConfig plugin configurations |
| 340 | * @throws IOException when fails to do IO operations |
| 341 | */ |
| 342 | private void addMethodsInConflictCase(YangPluginConfig pluginConfig) throws IOException { |
| 343 | JavaAttributeInfo attr = getIntAttribute(); |
| 344 | if (attr != null) { |
| 345 | attr = getUIntAttribute(); |
| 346 | } |
| 347 | if (attr != null) { |
| 348 | if (attr.isIntConflict()) { |
| 349 | if (getIntIndex() < getUIntIndex()) { |
| 350 | appendToFile(getOfStringImplTempFileHandle(), getOfMethodStringAndJavaDoc(getIntAttribute(), |
| 351 | getGeneratedJavaClassName(), pluginConfig) |
| 352 | + NEW_LINE); |
| 353 | addGetterImpl(getIntAttribute(), pluginConfig); |
| 354 | addFromStringMethod(getIntAttribute(), pluginConfig); |
| 355 | } else { |
| 356 | appendToFile(getOfStringImplTempFileHandle(), getOfMethodStringAndJavaDoc(getUIntAttribute(), |
| 357 | getGeneratedJavaClassName(), pluginConfig) |
| 358 | + NEW_LINE); |
| 359 | addGetterImpl(getUIntAttribute(), pluginConfig); |
| 360 | addFromStringMethod(getUIntAttribute(), pluginConfig); |
| 361 | } |
| 362 | } |
| 363 | } |
| 364 | attr = getLongAttribute(); |
| 365 | if (attr != null) { |
| 366 | attr = getULongAttribute(); |
| 367 | } |
| 368 | if (attr != null) { |
| 369 | if (attr.isLongConflict()) { |
| 370 | if (getLongIndex() < getULongIndex()) { |
| 371 | appendToFile(getOfStringImplTempFileHandle(), getOfMethodStringAndJavaDoc(getLongAttribute(), |
| 372 | getGeneratedJavaClassName(), pluginConfig) |
| 373 | + NEW_LINE); |
| 374 | addGetterImpl(getLongAttribute(), pluginConfig); |
| 375 | addFromStringMethod(getLongAttribute(), pluginConfig); |
| 376 | } else { |
| 377 | appendToFile(getOfStringImplTempFileHandle(), getOfMethodStringAndJavaDoc(getULongAttribute(), |
| 378 | getGeneratedJavaClassName(), pluginConfig) |
| 379 | + NEW_LINE); |
| 380 | addGetterImpl(getULongAttribute(), pluginConfig); |
| 381 | addFromStringMethod(getULongAttribute(), pluginConfig); |
| 382 | } |
| 383 | } |
| 384 | } |
| 385 | } |
| 386 | |
| 387 | /** |
| 388 | * Adds from string method for conflict case. |
| 389 | * |
| 390 | * @param newAttrInfo new attribute |
| 391 | * @param pluginConfig plugin configurations |
| 392 | * @throws IOException when fails to do IO operations |
| 393 | */ |
| 394 | private void addFromStringMethod(JavaAttributeInfo newAttrInfo, YangPluginConfig pluginConfig) throws IOException { |
| 395 | |
Shankara-Huawei | b756477 | 2016-08-02 18:13:13 +0530 | [diff] [blame] | 396 | JavaQualifiedTypeInfoTranslator qualifiedInfoOfFromString = getQualifiedInfoOfFromString(newAttrInfo, |
Bharat saraswal | 64e7e23 | 2016-07-14 23:33:55 +0530 | [diff] [blame] | 397 | pluginConfig.getConflictResolver()); |
| 398 | /* |
| 399 | * Create a new java attribute info with qualified information of |
| 400 | * wrapper classes. |
| 401 | */ |
| 402 | JavaAttributeInfo fromStringAttributeInfo = getAttributeInfoForTheData(qualifiedInfoOfFromString, |
| 403 | newAttrInfo.getAttributeName(), |
| 404 | newAttrInfo.getAttributeType(), |
| 405 | getIsQualifiedAccessOrAddToImportList(qualifiedInfoOfFromString), false); |
| 406 | |
| 407 | addFromStringMethod(newAttrInfo, fromStringAttributeInfo); |
| 408 | } |
| 409 | |
| 410 | /** |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 411 | * Adds type constructor. |
| 412 | * |
Bharat saraswal | 64e7e23 | 2016-07-14 23:33:55 +0530 | [diff] [blame] | 413 | * @param attr attribute info |
Bharat saraswal | 715d3fc | 2016-05-17 19:59:16 +0530 | [diff] [blame] | 414 | * @param pluginConfig plugin configurations |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 415 | * @throws IOException when fails to append to temporary file |
| 416 | */ |
Bharat saraswal | 715d3fc | 2016-05-17 19:59:16 +0530 | [diff] [blame] | 417 | private void addTypeConstructor(JavaAttributeInfo attr, YangPluginConfig pluginConfig) |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 418 | throws IOException { |
| 419 | appendToFile(getConstructorForTypeTempFileHandle(), getTypeConstructorStringAndJavaDoc(attr, |
Bharat saraswal | 715d3fc | 2016-05-17 19:59:16 +0530 | [diff] [blame] | 420 | getGeneratedJavaClassName(), pluginConfig) + NEW_LINE); |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 421 | } |
| 422 | |
| 423 | /** |
Bharat saraswal | 64e7e23 | 2016-07-14 23:33:55 +0530 | [diff] [blame] | 424 | * Adds type constructor. |
| 425 | * |
| 426 | * @param pluginConfig plugin configurations |
| 427 | * @throws IOException when fails to append to temporary file |
| 428 | */ |
| 429 | private void addTypeConstructor(YangPluginConfig pluginConfig) |
| 430 | throws IOException { |
| 431 | JavaAttributeInfo attr = getIntAttribute(); |
| 432 | if (attr != null) { |
| 433 | attr = getUIntAttribute(); |
| 434 | } |
| 435 | if (attr != null) { |
| 436 | if (attr.isIntConflict()) { |
| 437 | appendToFile(getConstructorForTypeTempFileHandle(), getTypeConstructorStringAndJavaDoc( |
| 438 | getIntAttribute(), |
| 439 | getUIntAttribute(), getGeneratedJavaClassName(), pluginConfig, INT_TYPE_CONFLICT, |
| 440 | getIntIndex() |
| 441 | < getUIntIndex()) + NEW_LINE); |
| 442 | } |
| 443 | } |
| 444 | attr = getLongAttribute(); |
| 445 | if (attr != null) { |
| 446 | attr = getULongAttribute(); |
| 447 | } |
| 448 | if (attr != null) { |
| 449 | if (attr.isLongConflict()) { |
| 450 | appendToFile(getConstructorForTypeTempFileHandle(), getTypeConstructorStringAndJavaDoc( |
| 451 | getLongAttribute(), |
| 452 | getULongAttribute(), getGeneratedJavaClassName(), pluginConfig, LONG_TYPE_CONFLICT, |
| 453 | getLongIndex() |
| 454 | < getULongIndex()) + NEW_LINE); |
| 455 | } |
| 456 | } |
| 457 | } |
| 458 | |
| 459 | /** |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 460 | * Adds of string for type. |
| 461 | * |
Bharat saraswal | 64e7e23 | 2016-07-14 23:33:55 +0530 | [diff] [blame] | 462 | * @param attr attribute info |
Bharat saraswal | 715d3fc | 2016-05-17 19:59:16 +0530 | [diff] [blame] | 463 | * @param pluginConfig plugin configurations |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 464 | * @throws IOException when fails to append to temporary file |
| 465 | */ |
Bharat saraswal | 715d3fc | 2016-05-17 19:59:16 +0530 | [diff] [blame] | 466 | private void addOfStringMethod(JavaAttributeInfo attr, YangPluginConfig pluginConfig) |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 467 | throws IOException { |
| 468 | appendToFile(getOfStringImplTempFileHandle(), getOfMethodStringAndJavaDoc(attr, |
Bharat saraswal | 715d3fc | 2016-05-17 19:59:16 +0530 | [diff] [blame] | 469 | getGeneratedJavaClassName(), pluginConfig) |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 470 | + NEW_LINE); |
| 471 | } |
| 472 | |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 473 | /** |
| 474 | * Removes all temporary file handles. |
| 475 | * |
Bharat saraswal | 64e7e23 | 2016-07-14 23:33:55 +0530 | [diff] [blame] | 476 | * @param isErrorOccurred flag to tell translator that error has occurred while file generation |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 477 | * @throws IOException when failed to delete the temporary files |
| 478 | */ |
Bharat saraswal | 250a747 | 2016-05-12 13:16:57 +0530 | [diff] [blame] | 479 | @Override |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 480 | public void freeTemporaryResources(boolean isErrorOccurred) |
| 481 | throws IOException { |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 482 | |
| 483 | if ((getGeneratedJavaFiles() & GENERATE_TYPEDEF_CLASS) != 0) { |
Bharat saraswal | 64e7e23 | 2016-07-14 23:33:55 +0530 | [diff] [blame] | 484 | closeFile(getTypedefClassJavaFileHandle(), isErrorOccurred); |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 485 | } |
| 486 | |
| 487 | if ((getGeneratedJavaFiles() & GENERATE_UNION_CLASS) != 0) { |
Bharat saraswal | 64e7e23 | 2016-07-14 23:33:55 +0530 | [diff] [blame] | 488 | closeFile(getTypeClassJavaFileHandle(), isErrorOccurred); |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 489 | } |
| 490 | |
| 491 | if ((getGeneratedTempFiles() & CONSTRUCTOR_FOR_TYPE_MASK) != 0) { |
| 492 | closeFile(getConstructorForTypeTempFileHandle(), true); |
| 493 | } |
| 494 | if ((getGeneratedTempFiles() & OF_STRING_IMPL_MASK) != 0) { |
| 495 | closeFile(getOfStringImplTempFileHandle(), true); |
| 496 | } |
| 497 | if ((getGeneratedTempFiles() & FROM_STRING_IMPL_MASK) != 0) { |
| 498 | closeFile(getFromStringImplTempFileHandle(), true); |
| 499 | } |
| 500 | |
| 501 | super.freeTemporaryResources(isErrorOccurred); |
Bharat saraswal | 250a747 | 2016-05-12 13:16:57 +0530 | [diff] [blame] | 502 | |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 503 | } |
| 504 | |
| 505 | /** |
| 506 | * Constructs java code exit. |
| 507 | * |
| 508 | * @param fileType generated file type |
Bharat saraswal | 64e7e23 | 2016-07-14 23:33:55 +0530 | [diff] [blame] | 509 | * @param curNode current YANG node |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 510 | * @throws IOException when fails to generate java files |
| 511 | */ |
Bharat saraswal | 250a747 | 2016-05-12 13:16:57 +0530 | [diff] [blame] | 512 | @Override |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 513 | public void generateJavaFile(int fileType, YangNode curNode) |
| 514 | throws IOException { |
| 515 | List<String> imports = new ArrayList<>(); |
| 516 | if (isAttributePresent()) { |
| 517 | imports = getJavaImportData().getImports(); |
| 518 | } |
| 519 | |
| 520 | createPackage(curNode); |
| 521 | |
| 522 | /* |
| 523 | * Creates type def class file. |
| 524 | */ |
| 525 | if ((fileType & GENERATE_TYPEDEF_CLASS) != 0) { |
Shankara-Huawei | a1039e5 | 2016-07-14 16:53:09 +0530 | [diff] [blame] | 526 | addImportsToStringAndHasCodeMethods(imports, true); |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 527 | setTypedefClassJavaFileHandle(getJavaFileHandle(getJavaClassName(TYPEDEF_CLASS_FILE_NAME_SUFFIX))); |
Gaurav Agrawal | 8a14752 | 2016-08-10 13:43:01 +0530 | [diff] [blame^] | 528 | |
| 529 | // In case if data type is binary, MoreObjects is not required and should be removed. |
| 530 | if (curNode instanceof YangTypeHolder) { |
| 531 | YangType yangType = ((YangTypeHolder) curNode).getTypeList().get(0); |
| 532 | if (yangType.getDataType() == YangDataTypes.BINARY) { |
| 533 | imports.remove(getJavaImportData().getImportForToString()); |
| 534 | } |
| 535 | } |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 536 | generateTypeDefClassFile(getTypedefClassJavaFileHandle(), curNode, imports); |
| 537 | } |
| 538 | /* |
| 539 | * Creates type class file. |
| 540 | */ |
| 541 | if ((fileType & GENERATE_UNION_CLASS) != 0) { |
Shankara-Huawei | a1039e5 | 2016-07-14 16:53:09 +0530 | [diff] [blame] | 542 | addImportsToStringAndHasCodeMethods(imports, true); |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 543 | setTypeClassJavaFileHandle(getJavaFileHandle(getJavaClassName(UNION_TYPE_CLASS_FILE_NAME_SUFFIX))); |
| 544 | generateUnionClassFile(getTypeClassJavaFileHandle(), curNode, imports); |
| 545 | } |
| 546 | |
| 547 | /* |
| 548 | * Close all the file handles. |
| 549 | */ |
| 550 | freeTemporaryResources(false); |
| 551 | } |
Bharat saraswal | 64e7e23 | 2016-07-14 23:33:55 +0530 | [diff] [blame] | 552 | |
| 553 | /** |
| 554 | * Returns int type index from type list. |
| 555 | * |
| 556 | * @return int type index from type list |
| 557 | */ |
| 558 | public int getIntIndex() { |
| 559 | return intIndex; |
| 560 | } |
| 561 | |
| 562 | /** |
| 563 | * Sets int type index from type list. |
| 564 | * |
| 565 | * @param intIndex int type index from type list. |
| 566 | */ |
| 567 | private void setIntIndex(int intIndex) { |
| 568 | this.intIndex = intIndex; |
| 569 | } |
| 570 | |
| 571 | /** |
| 572 | * Returns uInt type index from type list. |
| 573 | * |
| 574 | * @return uInt type index from type list |
| 575 | */ |
| 576 | public int getUIntIndex() { |
| 577 | return uIntIndex; |
| 578 | } |
| 579 | |
| 580 | /** |
| 581 | * Sets uInt type index from type list. |
| 582 | * |
| 583 | * @param uIntIndex uInt type index from type list. |
| 584 | */ |
| 585 | private void setUIntIndex(int uIntIndex) { |
| 586 | this.uIntIndex = uIntIndex; |
| 587 | } |
| 588 | |
| 589 | /** |
| 590 | * Returns long type index from type list. |
| 591 | * |
| 592 | * @return long type index from type list |
| 593 | */ |
| 594 | public int getLongIndex() { |
| 595 | return longIndex; |
| 596 | } |
| 597 | |
| 598 | /** |
| 599 | * Sets long type index from type list. |
| 600 | * |
| 601 | * @param longIndex long type index from type list. |
| 602 | */ |
| 603 | private void setLongIndex(int longIndex) { |
| 604 | this.longIndex = longIndex; |
| 605 | } |
| 606 | |
| 607 | /** |
| 608 | * Returns uLong type index from type list. |
| 609 | * |
| 610 | * @return uLong type index from type list |
| 611 | */ |
| 612 | public int getULongIndex() { |
| 613 | return uLongIndex; |
| 614 | } |
| 615 | |
| 616 | /** |
| 617 | * Sets uLong type index from type list. |
| 618 | * |
| 619 | * @param uLongIndex uLong type index from type list. |
| 620 | */ |
| 621 | private void setULongIndex(int uLongIndex) { |
| 622 | this.uLongIndex = uLongIndex; |
| 623 | } |
| 624 | |
| 625 | /** |
| 626 | * Validates conflict for int and uInt. |
| 627 | * |
| 628 | * @param typeList type list |
| 629 | * @return true if conflict is there |
| 630 | */ |
| 631 | private boolean validateForConflictingIntTypes(List<YangType<?>> typeList) { |
| 632 | boolean isIntPresent = false; |
| 633 | boolean isUIntPresent = false; |
| 634 | for (YangType type : typeList) { |
| 635 | if (type.getDataType().equals(INT32)) { |
| 636 | setIntIndex(typeList.indexOf(type)); |
| 637 | isIntPresent = true; |
| 638 | } |
| 639 | if (type.getDataType().equals(UINT16)) { |
| 640 | setUIntIndex(typeList.indexOf(type)); |
| 641 | isUIntPresent = true; |
| 642 | } |
| 643 | } |
| 644 | |
| 645 | return isIntPresent && isUIntPresent; |
| 646 | } |
| 647 | |
| 648 | /** |
| 649 | * Validates conflict for long and uLong. |
| 650 | * |
| 651 | * @param typeList type list |
| 652 | * @return true if conflict is there |
| 653 | */ |
| 654 | private boolean validateForConflictingLongTypes(List<YangType<?>> typeList) { |
| 655 | boolean isLongPresent = false; |
| 656 | boolean isULongPresent = false; |
| 657 | for (YangType type : typeList) { |
| 658 | if (type.getDataType().equals(INT64)) { |
| 659 | setLongIndex(typeList.indexOf(type)); |
| 660 | isLongPresent = true; |
| 661 | } |
| 662 | if (type.getDataType().equals(UINT32)) { |
| 663 | setULongIndex(typeList.indexOf(type)); |
| 664 | isULongPresent = true; |
| 665 | } |
| 666 | } |
| 667 | |
| 668 | return isLongPresent && isULongPresent; |
| 669 | } |
| 670 | |
| 671 | /** |
| 672 | * Updates attribute info in case of conflicts. |
| 673 | * |
| 674 | * @param javaAttributeInfo java attribute info |
| 675 | */ |
| 676 | private void updateAttributeCondition(JavaAttributeInfo javaAttributeInfo) { |
| 677 | |
| 678 | if (javaAttributeInfo.isIntConflict()) { |
| 679 | if (javaAttributeInfo.getAttributeType().getDataType() == UINT16) { |
| 680 | setUIntAttribute(javaAttributeInfo); |
| 681 | } else if (javaAttributeInfo.getAttributeType().getDataType() == INT32) { |
| 682 | setIntAttribute(javaAttributeInfo); |
| 683 | } |
| 684 | |
| 685 | } |
| 686 | if (javaAttributeInfo.isLongConflict()) { |
| 687 | if (javaAttributeInfo.getAttributeType().getDataType() == UINT32) { |
| 688 | setULongAttribute(javaAttributeInfo); |
| 689 | } else if (javaAttributeInfo.getAttributeType().getDataType() == INT64) { |
| 690 | setLongAttribute(javaAttributeInfo); |
| 691 | } |
| 692 | |
| 693 | } |
| 694 | } |
| 695 | |
| 696 | /** |
| 697 | * Returns attribute for int. |
| 698 | * |
| 699 | * @return attribute for int |
| 700 | */ |
| 701 | public JavaAttributeInfo getIntAttribute() { |
| 702 | return intAttribute; |
| 703 | } |
| 704 | |
| 705 | /** |
| 706 | * Sets attribute for int. |
| 707 | * |
| 708 | * @param intAttribute attribute for int |
| 709 | */ |
| 710 | private void setIntAttribute(JavaAttributeInfo intAttribute) { |
| 711 | this.intAttribute = intAttribute; |
| 712 | } |
| 713 | |
| 714 | /** |
| 715 | * Returns attribute for long. |
| 716 | * |
| 717 | * @return attribute for long |
| 718 | */ |
| 719 | public JavaAttributeInfo getLongAttribute() { |
| 720 | return longAttribute; |
| 721 | } |
| 722 | |
| 723 | /** |
| 724 | * Sets attribute for long. |
| 725 | * |
| 726 | * @param longAttribute attribute for long |
| 727 | */ |
| 728 | private void setLongAttribute(JavaAttributeInfo longAttribute) { |
| 729 | this.longAttribute = longAttribute; |
| 730 | } |
| 731 | |
| 732 | /** |
| 733 | * Returns attribute for uInt. |
| 734 | * |
| 735 | * @return attribute for uInt |
| 736 | */ |
| 737 | public JavaAttributeInfo getUIntAttribute() { |
| 738 | return uIntAttribute; |
| 739 | } |
| 740 | |
| 741 | /** |
| 742 | * Sets attribute for uInt. |
| 743 | * |
| 744 | * @param uIntAttribute attribute for uInt |
| 745 | */ |
| 746 | private void setUIntAttribute(JavaAttributeInfo uIntAttribute) { |
| 747 | this.uIntAttribute = uIntAttribute; |
| 748 | } |
| 749 | |
| 750 | /** |
| 751 | * Returns attribute for uLong. |
| 752 | * |
| 753 | * @return attribute for uLong |
| 754 | */ |
| 755 | public JavaAttributeInfo getULongAttribute() { |
| 756 | return uLongAttribute; |
| 757 | } |
| 758 | |
| 759 | /** |
| 760 | * Sets attribute for uLong. |
| 761 | * |
| 762 | * @param uLongAttribute attribute for uLong |
| 763 | */ |
| 764 | private void setULongAttribute(JavaAttributeInfo uLongAttribute) { |
| 765 | this.uLongAttribute = uLongAttribute; |
| 766 | } |
Vinod Kumar S | 79a374b | 2016-04-30 21:09:15 +0530 | [diff] [blame] | 767 | } |