1 21 package proguard; 22 23 import java.util.*; 24 25 33 public class ClassSpecification implements Cloneable 34 { 35 public String comments; 36 public int requiredSetAccessFlags; 37 public int requiredUnsetAccessFlags; 38 public String annotationType; 39 public String className; 40 public String extendsAnnotationType; 41 public String extendsClassName; 42 43 public List fieldSpecifications; 44 public List methodSpecifications; 45 46 47 51 public ClassSpecification() 52 { 53 this(null, 54 0, 55 0, 56 null, 57 null, 58 null, 59 null); 60 } 61 62 63 66 public ClassSpecification(ClassSpecification classSpecification) 67 { 68 this(classSpecification.comments, 69 classSpecification.requiredSetAccessFlags, 70 classSpecification.requiredUnsetAccessFlags, 71 classSpecification.annotationType, 72 classSpecification.className, 73 classSpecification.extendsAnnotationType, 74 classSpecification.extendsClassName, 75 classSpecification.fieldSpecifications, 76 classSpecification.methodSpecifications); 77 } 78 79 80 107 public ClassSpecification(String comments, 108 int requiredSetAccessFlags, 109 int requiredUnsetAccessFlags, 110 String annotationType, 111 String className, 112 String extendsAnnotationType, 113 String extendsClassName) 114 { 115 this(comments, 116 requiredSetAccessFlags, 117 requiredUnsetAccessFlags, 118 annotationType, 119 className, 120 extendsAnnotationType, 121 extendsClassName, 122 null, 123 null); 124 } 125 126 127 156 public ClassSpecification(String comments, 157 int requiredSetAccessFlags, 158 int requiredUnsetAccessFlags, 159 String annotationType, 160 String className, 161 String extendsAnnotationType, 162 String extendsClassName, 163 List fieldSpecifications, 164 List methodSpecifications) 165 { 166 this.comments = comments; 167 this.requiredSetAccessFlags = requiredSetAccessFlags; 168 this.requiredUnsetAccessFlags = requiredUnsetAccessFlags; 169 this.annotationType = annotationType; 170 this.className = className; 171 this.extendsAnnotationType = extendsAnnotationType; 172 this.extendsClassName = extendsClassName; 173 this.fieldSpecifications = fieldSpecifications; 174 this.methodSpecifications = methodSpecifications; 175 } 176 177 178 183 public void addField(MemberSpecification fieldSpecification) 184 { 185 if (fieldSpecifications == null) 186 { 187 fieldSpecifications = new ArrayList(); 188 } 189 190 fieldSpecifications.add(fieldSpecification); 191 } 192 193 194 199 public void addMethod(MemberSpecification methodSpecification) 200 { 201 if (methodSpecifications == null) 202 { 203 methodSpecifications = new ArrayList(); 204 } 205 206 methodSpecifications.add(methodSpecification); 207 } 208 209 210 211 213 public boolean equals(Object object) 214 { 215 if (object == null || 216 this.getClass() != object.getClass()) 217 { 218 return false; 219 } 220 221 ClassSpecification other = (ClassSpecification)object; 222 return 223 (this.requiredSetAccessFlags == other.requiredSetAccessFlags ) && 225 (this.requiredUnsetAccessFlags == other.requiredUnsetAccessFlags ) && 226 (this.annotationType == null ? other.annotationType == null : this.annotationType.equals(other.annotationType) ) && 227 (this.className == null ? other.className == null : this.className.equals(other.className) ) && 228 (this.extendsAnnotationType == null ? other.extendsAnnotationType == null : this.extendsAnnotationType.equals(other.extendsAnnotationType)) && 229 (this.extendsClassName == null ? other.extendsClassName == null : this.extendsClassName.equals(other.extendsClassName) ) && 230 (this.fieldSpecifications == null ? other.fieldSpecifications == null : this.fieldSpecifications.equals(other.fieldSpecifications) ) && 231 (this.methodSpecifications == null ? other.methodSpecifications == null : this.methodSpecifications.equals(other.methodSpecifications) ); 232 } 233 234 public int hashCode() 235 { 236 return 237 (requiredSetAccessFlags ) ^ 239 (requiredUnsetAccessFlags ) ^ 240 (annotationType == null ? 0 : annotationType.hashCode() ) ^ 241 (className == null ? 0 : className.hashCode() ) ^ 242 (extendsAnnotationType == null ? 0 : extendsAnnotationType.hashCode()) ^ 243 (extendsClassName == null ? 0 : extendsClassName.hashCode() ) ^ 244 (fieldSpecifications == null ? 0 : fieldSpecifications.hashCode() ) ^ 245 (methodSpecifications == null ? 0 : methodSpecifications.hashCode() ); 246 } 247 248 public Object clone() 249 { 250 try 251 { 252 return super.clone(); 253 } 254 catch (CloneNotSupportedException e) 255 { 256 return null; 257 } 258 } 259 } 260 | Popular Tags |