Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 1 | /* |
Brian O'Connor | 0f7908b | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2016-present Open Networking Laboratory |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package org.onosproject.yangutils.translator.tojava; |
| 18 | |
Bharat saraswal | 0663aff | 2016-10-18 23:16:14 +0530 | [diff] [blame] | 19 | import com.google.common.base.MoreObjects; |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 20 | import org.onosproject.yangutils.datamodel.YangNode; |
Shankara-Huawei | b756477 | 2016-08-02 18:13:13 +0530 | [diff] [blame] | 21 | import org.onosproject.yangutils.datamodel.javadatamodel.JavaQualifiedTypeInfo; |
Bharat saraswal | 780eca3 | 2016-04-05 12:45:45 +0530 | [diff] [blame] | 22 | import org.onosproject.yangutils.translator.exception.TranslatorException; |
Bharat saraswal | 0663aff | 2016-10-18 23:16:14 +0530 | [diff] [blame] | 23 | import org.onosproject.yangutils.translator.tojava.javamodel.AttributesJavaDataType; |
| 24 | import org.onosproject.yangutils.translator.tojava.javamodel.JavaLeafInfoContainer; |
Bharat saraswal | 2da23bf | 2016-08-25 15:28:39 +0530 | [diff] [blame] | 25 | import org.onosproject.yangutils.utils.io.YangToJavaNamingConflictUtil; |
Vinod Kumar S | 79a374b | 2016-04-30 21:09:15 +0530 | [diff] [blame] | 26 | |
Bharat saraswal | 0663aff | 2016-10-18 23:16:14 +0530 | [diff] [blame] | 27 | import java.io.Serializable; |
| 28 | import java.util.Objects; |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 29 | |
Bharat saraswal | 0663aff | 2016-10-18 23:16:14 +0530 | [diff] [blame] | 30 | import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.BINARY; |
| 31 | import static org.onosproject.yangutils.translator.tojava.javamodel.AttributesJavaDataType.getJavaImportClass; |
| 32 | import static org.onosproject.yangutils.translator.tojava.javamodel.AttributesJavaDataType.getJavaImportPackage; |
Mahesh Poojary Huawei | 1025a17 | 2016-09-27 16:06:07 +0530 | [diff] [blame] | 33 | import static org.onosproject.yangutils.utils.UtilConstants.BASE64; |
Mahesh Poojary Huawei | 9a16ea0 | 2016-09-02 22:59:00 +0530 | [diff] [blame] | 34 | import static org.onosproject.yangutils.utils.UtilConstants.COLLECTION_IMPORTS; |
Gaurav Agrawal | 97a5e1c | 2016-04-18 18:53:11 +0530 | [diff] [blame] | 35 | |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 36 | /** |
Bharat saraswal | 63f26fb | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 37 | * Represents the information about individual imports in the generated file. |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 38 | */ |
VinodKumarS-Huawei | 3288910 | 2016-09-06 10:54:37 +0530 | [diff] [blame] | 39 | public class JavaQualifiedTypeInfoTranslator |
| 40 | extends JavaQualifiedTypeInfo |
Shankara-Huawei | b756477 | 2016-08-02 18:13:13 +0530 | [diff] [blame] | 41 | implements Comparable<JavaQualifiedTypeInfoTranslator>, Serializable { |
Bharat saraswal | c2d3be1 | 2016-06-16 00:29:12 +0530 | [diff] [blame] | 42 | private static final long serialVersionUID = 806201634L; |
Bharat saraswal | 0663aff | 2016-10-18 23:16:14 +0530 | [diff] [blame] | 43 | private boolean isQualified; |
Bharat saraswal | 51c5d67 | 2016-11-13 09:03:48 +0530 | [diff] [blame^] | 44 | private boolean isForInterface = true; |
Bharat saraswal | c2d3be1 | 2016-06-16 00:29:12 +0530 | [diff] [blame] | 45 | |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 46 | /** |
Bharat saraswal | 63f26fb | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 47 | * Creates a java qualified type info object. |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 48 | */ |
Shankara-Huawei | b756477 | 2016-08-02 18:13:13 +0530 | [diff] [blame] | 49 | public JavaQualifiedTypeInfoTranslator() { |
Bharat saraswal | 2da23bf | 2016-08-25 15:28:39 +0530 | [diff] [blame] | 50 | super(); |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 51 | } |
| 52 | |
| 53 | /** |
Bharat saraswal | 63f26fb | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 54 | * Returns the imported package info. |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 55 | * |
| 56 | * @return the imported package info |
| 57 | */ |
| 58 | public String getPkgInfo() { |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 59 | return pkgInfo; |
| 60 | } |
| 61 | |
| 62 | /** |
Bharat saraswal | 63f26fb | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 63 | * Sets the imported package info. |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 64 | * |
| 65 | * @param pkgInfo the imported package info |
| 66 | */ |
| 67 | public void setPkgInfo(String pkgInfo) { |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 68 | this.pkgInfo = pkgInfo; |
| 69 | } |
| 70 | |
| 71 | /** |
Bharat saraswal | 63f26fb | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 72 | * Returns the imported class/interface info. |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 73 | * |
| 74 | * @return the imported class/interface info |
| 75 | */ |
| 76 | public String getClassInfo() { |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 77 | return classInfo; |
| 78 | } |
| 79 | |
| 80 | /** |
Bharat saraswal | 63f26fb | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 81 | * Sets the imported class/interface info. |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 82 | * |
| 83 | * @param classInfo the imported class/interface info |
| 84 | */ |
| 85 | public void setClassInfo(String classInfo) { |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 86 | this.classInfo = classInfo; |
| 87 | } |
| 88 | |
| 89 | /** |
Vinod Kumar S | 79a374b | 2016-04-30 21:09:15 +0530 | [diff] [blame] | 90 | * Updates the leaf's java information. |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 91 | * |
Bharat saraswal | 715d3fc | 2016-05-17 19:59:16 +0530 | [diff] [blame] | 92 | * @param leaf leaf whose java information is being updated |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 93 | */ |
VinodKumarS-Huawei | 3288910 | 2016-09-06 10:54:37 +0530 | [diff] [blame] | 94 | public static void updateLeavesJavaQualifiedInfo( |
| 95 | JavaLeafInfoContainer leaf) { |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 96 | |
VinodKumarS-Huawei | 3288910 | 2016-09-06 10:54:37 +0530 | [diff] [blame] | 97 | JavaQualifiedTypeInfoTranslator importInfo = |
| 98 | (JavaQualifiedTypeInfoTranslator) leaf.getJavaQualifiedInfo(); |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 99 | |
Vinod Kumar S | 79a374b | 2016-04-30 21:09:15 +0530 | [diff] [blame] | 100 | if (leaf.getDataType() == null) { |
VinodKumarS-Huawei | 3288910 | 2016-09-06 10:54:37 +0530 | [diff] [blame] | 101 | throw new TranslatorException( |
| 102 | "missing data type of leaf " + leaf.getName() |
| 103 | + " in " + leaf.getLineNumber() + " at" + |
| 104 | leaf.getCharPosition() + " in " + |
| 105 | leaf.getFileName()); |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 106 | } |
| 107 | |
| 108 | /* |
| 109 | * Current leaves holder is adding a leaf info as a attribute to the |
| 110 | * current class. |
| 111 | */ |
VinodKumarS-Huawei | 3288910 | 2016-09-06 10:54:37 +0530 | [diff] [blame] | 112 | String className = |
| 113 | getJavaImportClass(leaf.getDataType(), leaf.isLeafList(), |
| 114 | leaf.getConflictResolveConfig()); |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 115 | if (className != null) { |
| 116 | /* |
| 117 | * Corresponding to the attribute type a class needs to be imported, |
| 118 | * since it can be a derived type or a usage of wrapper classes. |
| 119 | */ |
| 120 | importInfo.setClassInfo(className); |
Bharat saraswal | 8beac34 | 2016-08-04 02:00:03 +0530 | [diff] [blame] | 121 | String classPkg = getJavaImportPackage(leaf.getDataType(), |
VinodKumarS-Huawei | 3288910 | 2016-09-06 10:54:37 +0530 | [diff] [blame] | 122 | leaf.isLeafList(), |
| 123 | leaf.getConflictResolveConfig()); |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 124 | if (classPkg == null) { |
VinodKumarS-Huawei | 3288910 | 2016-09-06 10:54:37 +0530 | [diff] [blame] | 125 | throw new TranslatorException( |
| 126 | "import package cannot be null when the class is used" + |
| 127 | " for " |
| 128 | + leaf.getName() |
| 129 | + " in " + leaf.getLineNumber() + " at" + |
| 130 | leaf.getCharPosition() + " in " + |
| 131 | leaf.getFileName()); |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 132 | } |
| 133 | importInfo.setPkgInfo(classPkg); |
| 134 | } else { |
| 135 | /* |
| 136 | * The attribute does not need a class to be imported, for example |
| 137 | * built in java types. |
| 138 | */ |
VinodKumarS-Huawei | 3288910 | 2016-09-06 10:54:37 +0530 | [diff] [blame] | 139 | String dataTypeName = |
| 140 | AttributesJavaDataType.getJavaDataType(leaf.getDataType()); |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 141 | if (dataTypeName == null) { |
Bharat saraswal | e3175d3 | 2016-08-31 17:50:11 +0530 | [diff] [blame] | 142 | throw new TranslatorException("not supported data type for " |
VinodKumarS-Huawei | 3288910 | 2016-09-06 10:54:37 +0530 | [diff] [blame] | 143 | + leaf.getName() |
| 144 | + " in " + |
| 145 | leaf.getLineNumber() + |
| 146 | " at" + |
| 147 | leaf.getCharPosition() + |
| 148 | " in " + |
| 149 | leaf.getFileName()); |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 150 | } |
| 151 | importInfo.setClassInfo(dataTypeName); |
| 152 | } |
VinodKumarS-Huawei | 8f16422 | 2016-08-31 15:47:30 +0530 | [diff] [blame] | 153 | |
VinodKumarS-Huawei | 3288910 | 2016-09-06 10:54:37 +0530 | [diff] [blame] | 154 | leaf.getJavaQualifiedInfo().setJavaAttributeName(leaf.getJavaName( |
| 155 | leaf.getConflictResolveConfig())); |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 156 | } |
| 157 | |
| 158 | /** |
Bharat saraswal | 63f26fb | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 159 | * Returns the import info for an attribute, which needs to be used for code |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 160 | * generation for import or for qualified access. |
| 161 | * |
VinodKumarS-Huawei | 3288910 | 2016-09-06 10:54:37 +0530 | [diff] [blame] | 162 | * @param curNode current data model node for which the java file |
| 163 | * is being |
VinodKumarS-Huawei | d81eccb | 2016-06-01 14:30:22 +0530 | [diff] [blame] | 164 | * generated |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 165 | * @param attributeName name of the attribute being added, it will used in |
VinodKumarS-Huawei | d81eccb | 2016-06-01 14:30:22 +0530 | [diff] [blame] | 166 | * import info for child class |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 167 | * @return return the import info for this attribute |
| 168 | */ |
VinodKumarS-Huawei | 3288910 | 2016-09-06 10:54:37 +0530 | [diff] [blame] | 169 | public static JavaQualifiedTypeInfoTranslator getQualifiedTypeInfoOfCurNode( |
| 170 | YangNode curNode, |
| 171 | String attributeName) { |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 172 | |
VinodKumarS-Huawei | 3288910 | 2016-09-06 10:54:37 +0530 | [diff] [blame] | 173 | JavaQualifiedTypeInfoTranslator importInfo = |
| 174 | new JavaQualifiedTypeInfoTranslator(); |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 175 | |
Vinod Kumar S | 79a374b | 2016-04-30 21:09:15 +0530 | [diff] [blame] | 176 | if (!(curNode instanceof JavaFileInfoContainer)) { |
VinodKumarS-Huawei | 3288910 | 2016-09-06 10:54:37 +0530 | [diff] [blame] | 177 | throw new TranslatorException( |
| 178 | "missing java file information to get the package details " |
| 179 | + "of attribute corresponding to child node " + |
| 180 | curNode.getName() + |
| 181 | " in " + curNode.getLineNumber() + " at " + |
| 182 | curNode.getCharPosition() + " in " + |
| 183 | curNode.getFileName()); |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 184 | } |
VinodKumarS-Huawei | d81eccb | 2016-06-01 14:30:22 +0530 | [diff] [blame] | 185 | |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 186 | importInfo.setClassInfo(attributeName); |
VinodKumarS-Huawei | d81eccb | 2016-06-01 14:30:22 +0530 | [diff] [blame] | 187 | importInfo.setPkgInfo(((JavaFileInfoContainer) curNode) |
VinodKumarS-Huawei | 3288910 | 2016-09-06 10:54:37 +0530 | [diff] [blame] | 188 | .getJavaFileInfo().getPackage()); |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 189 | |
| 190 | return importInfo; |
| 191 | } |
| 192 | |
| 193 | /** |
Gaurav Agrawal | 02a60de | 2016-04-20 15:49:17 +0530 | [diff] [blame] | 194 | * Returns the java qualified type information for the wrapper classes. |
Gaurav Agrawal | 97a5e1c | 2016-04-18 18:53:11 +0530 | [diff] [blame] | 195 | * |
| 196 | * @param referredTypesAttrInfo attribute of referred type |
VinodKumarS-Huawei | d81eccb | 2016-06-01 14:30:22 +0530 | [diff] [blame] | 197 | * @param conflictResolver plugin configurations |
Gaurav Agrawal | 97a5e1c | 2016-04-18 18:53:11 +0530 | [diff] [blame] | 198 | * @return return the import info for this attribute |
| 199 | */ |
VinodKumarS-Huawei | 3288910 | 2016-09-06 10:54:37 +0530 | [diff] [blame] | 200 | static JavaQualifiedTypeInfoTranslator getQualifiedInfoOfFromString( |
| 201 | JavaAttributeInfo referredTypesAttrInfo, |
| 202 | YangToJavaNamingConflictUtil conflictResolver) { |
Bharat saraswal | 250a747 | 2016-05-12 13:16:57 +0530 | [diff] [blame] | 203 | |
Gaurav Agrawal | 97a5e1c | 2016-04-18 18:53:11 +0530 | [diff] [blame] | 204 | /* |
| 205 | * Get the java qualified type information for the wrapper classes and |
| 206 | * set it in new java attribute information. |
| 207 | */ |
VinodKumarS-Huawei | 3288910 | 2016-09-06 10:54:37 +0530 | [diff] [blame] | 208 | JavaQualifiedTypeInfoTranslator qualifiedInfoOfFromString = |
| 209 | new JavaQualifiedTypeInfoTranslator(); |
Bharat saraswal | 715d3fc | 2016-05-17 19:59:16 +0530 | [diff] [blame] | 210 | |
Mahesh Poojary Huawei | 9a16ea0 | 2016-09-02 22:59:00 +0530 | [diff] [blame] | 211 | if (referredTypesAttrInfo.getAttributeType().getDataType() == BINARY) { |
| 212 | qualifiedInfoOfFromString.setClassInfo(BASE64); |
| 213 | qualifiedInfoOfFromString.setPkgInfo(COLLECTION_IMPORTS); |
| 214 | } else { |
| 215 | qualifiedInfoOfFromString.setClassInfo( |
VinodKumarS-Huawei | 3288910 | 2016-09-06 10:54:37 +0530 | [diff] [blame] | 216 | getJavaImportClass(referredTypesAttrInfo.getAttributeType(), |
| 217 | true, conflictResolver)); |
Mahesh Poojary Huawei | 9a16ea0 | 2016-09-02 22:59:00 +0530 | [diff] [blame] | 218 | qualifiedInfoOfFromString.setPkgInfo( |
VinodKumarS-Huawei | 3288910 | 2016-09-06 10:54:37 +0530 | [diff] [blame] | 219 | getJavaImportPackage( |
| 220 | referredTypesAttrInfo.getAttributeType(), true, |
| 221 | conflictResolver)); |
Mahesh Poojary Huawei | 9a16ea0 | 2016-09-02 22:59:00 +0530 | [diff] [blame] | 222 | } |
Gaurav Agrawal | 97a5e1c | 2016-04-18 18:53:11 +0530 | [diff] [blame] | 223 | return qualifiedInfoOfFromString; |
| 224 | } |
| 225 | |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 226 | @Override |
| 227 | public int hashCode() { |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 228 | return Objects.hash(pkgInfo, classInfo); |
| 229 | } |
| 230 | |
| 231 | @Override |
| 232 | public boolean equals(Object obj) { |
| 233 | |
| 234 | if (this == obj) { |
| 235 | return true; |
| 236 | } |
Shankara-Huawei | b756477 | 2016-08-02 18:13:13 +0530 | [diff] [blame] | 237 | if (obj instanceof JavaQualifiedTypeInfoTranslator) { |
VinodKumarS-Huawei | 3288910 | 2016-09-06 10:54:37 +0530 | [diff] [blame] | 238 | JavaQualifiedTypeInfoTranslator other = |
| 239 | (JavaQualifiedTypeInfoTranslator) obj; |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 240 | return Objects.equals(pkgInfo, other.pkgInfo) && |
| 241 | Objects.equals(classInfo, other.classInfo); |
| 242 | } |
| 243 | return false; |
| 244 | } |
| 245 | |
| 246 | /** |
Bharat saraswal | e2bc60d | 2016-04-16 02:28:25 +0530 | [diff] [blame] | 247 | * Checks if the import info matches. |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 248 | * |
| 249 | * @param importInfo matched import |
| 250 | * @return if equal or not |
| 251 | */ |
Shankara-Huawei | b756477 | 2016-08-02 18:13:13 +0530 | [diff] [blame] | 252 | public boolean exactMatch(JavaQualifiedTypeInfoTranslator importInfo) { |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 253 | return equals(importInfo) |
| 254 | && Objects.equals(pkgInfo, importInfo.getPkgInfo()) |
| 255 | && Objects.equals(classInfo, importInfo.getClassInfo()); |
| 256 | } |
| 257 | |
| 258 | @Override |
| 259 | public String toString() { |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 260 | return MoreObjects.toStringHelper(getClass()) |
| 261 | .add("pkgInfo", pkgInfo) |
| 262 | .add("classInfo", classInfo).toString(); |
| 263 | } |
| 264 | |
| 265 | /** |
Bharat saraswal | 63f26fb | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 266 | * Checks that there is no 2 objects with the same class name. |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 267 | * |
| 268 | * @param other compared import info. |
| 269 | */ |
| 270 | @Override |
Shankara-Huawei | b756477 | 2016-08-02 18:13:13 +0530 | [diff] [blame] | 271 | public int compareTo(JavaQualifiedTypeInfoTranslator other) { |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 272 | return getClassInfo().compareTo(other.getClassInfo()); |
| 273 | } |
Bharat saraswal | 0663aff | 2016-10-18 23:16:14 +0530 | [diff] [blame] | 274 | |
| 275 | /** |
| 276 | * Returns true if import is qualified. |
| 277 | * |
| 278 | * @return true if import is qualified |
| 279 | */ |
| 280 | public boolean isQualified() { |
| 281 | return isQualified; |
| 282 | } |
| 283 | |
| 284 | /** |
| 285 | * Sets true if import is qualified. |
| 286 | * |
| 287 | * @param qualified true if import is qualified |
| 288 | */ |
| 289 | public void setQualified(boolean qualified) { |
| 290 | isQualified = qualified; |
| 291 | } |
Bharat saraswal | 51c5d67 | 2016-11-13 09:03:48 +0530 | [diff] [blame^] | 292 | |
| 293 | /** |
| 294 | * Returns true if import should be added to interface. |
| 295 | * |
| 296 | * @return true if import should be added to interface |
| 297 | */ |
| 298 | boolean isForInterface() { |
| 299 | return isForInterface; |
| 300 | } |
| 301 | |
| 302 | /** |
| 303 | * Sets true if import should be added to interface. |
| 304 | * |
| 305 | * @param forInterface true if import should be added to interface |
| 306 | */ |
| 307 | void setForInterface(boolean forInterface) { |
| 308 | isForInterface = forInterface; |
| 309 | } |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 310 | } |