1 21 22 27 28 package javax.mail.search; 29 30 import javax.mail.Message ; 31 import javax.mail.Address ; 32 33 43 44 public final class FromStringTerm extends AddressStringTerm { 45 46 private static final long serialVersionUID = 5801127523826772788L; 47 48 53 public FromStringTerm(String pattern) { 54 super(pattern); 55 } 56 57 65 public boolean match(Message msg) { 66 Address [] from; 67 68 try { 69 from = msg.getFrom(); 70 } catch (Exception e) { 71 return false; 72 } 73 74 if (from == null) 75 return false; 76 77 for (int i=0; i < from.length; i++) 78 if (super.match(from[i])) 79 return true; 80 return false; 81 } 82 83 86 public boolean equals(Object obj) { 87 if (!(obj instanceof FromStringTerm )) 88 return false; 89 return super.equals(obj); 90 } 91 } 92 | Popular Tags |