Example #1
0
 @Override
 public int hashCode() {
   final int PRIME = 31;
   int result = 1;
   result = PRIME * result + ((field == null) ? 0 : field.hashCode());
   return result;
 }
 private boolean allFieldsArePrimitive(IClass c) {
   if (c.isArrayClass()) {
     TypeReference t = c.getReference().getArrayElementType();
     return t.isPrimitiveType();
   } else {
     if (c.getReference().equals(TypeReference.JavaLangObject)) {
       return true;
     } else {
       for (Iterator<IField> it = c.getDeclaredInstanceFields().iterator(); it.hasNext(); ) {
         IField f = it.next();
         if (f.getReference().getFieldType().isReferenceType()) {
           return false;
         }
       }
       return allFieldsArePrimitive(c.getSuperclass());
     }
   }
 }
Example #3
0
 @Override
 public boolean equals(Object obj) {
   // instanceof is OK because this class is final
   if (obj instanceof StaticFieldKey) {
     StaticFieldKey other = (StaticFieldKey) obj;
     return field.equals(other.field);
   } else {
     return false;
   }
 }
Example #4
0
 @Override
 public boolean equals(Object obj) {
   if (this == obj) return true;
   if (obj == null) return false;
   if (getClass() != obj.getClass()) return false;
   final GetFieldLabel other = (GetFieldLabel) obj;
   if (field == null) {
     if (other.field != null) return false;
   } else if (!field.equals(other.field)) return false;
   return true;
 }
Example #5
0
 @Override
 public int hashCode() {
   return 1889 * field.hashCode();
 }