Guest User

Untitled

a guest
Oct 26th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 0.99 KB | None | 0 0
  1.     public boolean equals(Object obj) {
  2.         if (this == obj)
  3.             return true;
  4.         if (obj == null || !(obj instanceof AgentStatementInfo))
  5.             return false;
  6.         try {
  7.             Field fields[] = getClass().getDeclaredFields();
  8.             for (Field field : fields) {
  9.                 Object val = field.get(obj);
  10.                 Object thisVal = field.get(this);
  11.                 if (!(val instanceof MPaymentInsurer)
  12.                                 && !((val == null && thisVal == null)
  13.                                                 || (val == thisVal)
  14.                                                 || (val != null && val.equals(thisVal))))
  15.  
  16.                     return false;
  17.  
  18.             }
  19.         } catch (SecurityException e) {
  20.             e.printStackTrace();
  21.         } catch (IllegalArgumentException e) {
  22.             e.printStackTrace();
  23.         } catch (IllegalAccessException e) {
  24.             e.printStackTrace();
  25.         }
  26.         return true;
  27.     }
Add Comment
Please, Sign In to add comment