1 21 22 27 28 package javax.mail.search; 29 30 import javax.mail.Message ; 31 import javax.mail.Address ; 32 33 39 public final class FromTerm extends AddressTerm { 40 41 private static final long serialVersionUID = 5214730291502658665L; 42 43 47 public FromTerm(Address address) { 48 super(address); 49 } 50 51 57 public boolean match(Message msg) { 58 Address [] from; 59 60 try { 61 from = msg.getFrom(); 62 } catch (Exception e) { 63 return false; 64 } 65 66 if (from == null) 67 return false; 68 69 for (int i=0; i < from.length; i++) 70 if (super.match(from[i])) 71 return true; 72 return false; 73 } 74 75 78 public boolean equals(Object obj) { 79 if (!(obj instanceof FromTerm )) 80 return false; 81 return super.equals(obj); 82 } 83 } 84 | Popular Tags |