javax.mail.search
public final class: FromStringTerm [javadoc |
source]
java.lang.Object
javax.mail.search.SearchTerm
javax.mail.search.StringTerm
javax.mail.search.AddressStringTerm
javax.mail.search.FromStringTerm
All Implemented Interfaces:
Serializable
This class implements string comparisons for the From Address
header.
Note that this class differs from the FromTerm
class
in that this class does comparisons on address strings rather than Address
objects. The string comparisons are case-insensitive.
Method from javax.mail.search.FromStringTerm Summary: |
---|
equals, match |
Methods from javax.mail.search.AddressStringTerm: |
---|
equals, match |
Methods from javax.mail.search.SearchTerm: |
---|
match |
Methods from java.lang.Object: |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method from javax.mail.search.FromStringTerm Detail: |
public boolean equals(Object obj) {
if (!(obj instanceof FromStringTerm))
return false;
return super.equals(obj);
}
|
public boolean match(Message msg) {
Address[] from;
try {
from = msg.getFrom();
} catch (Exception e) {
return false;
}
if (from == null)
return false;
for (int i=0; i < from.length; i++)
if (super.match(from[i]))
return true;
return false;
}
Check whether the address string specified in the constructor is
a substring of the From address of this Message. |