javax.mail.search
public final class: RecipientStringTerm [javadoc |
source]
java.lang.Object
javax.mail.search.SearchTerm
javax.mail.search.StringTerm
javax.mail.search.AddressStringTerm
javax.mail.search.RecipientStringTerm
All Implemented Interfaces:
Serializable
This class implements string comparisons for the Recipient Address
headers.
Note that this class differs from the RecipientTerm
class
in that this class does comparisons on address strings rather than Address
objects. The string comparisons are case-insensitive.
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.RecipientStringTerm Detail: |
public boolean equals(Object obj) {
if (!(obj instanceof RecipientStringTerm))
return false;
RecipientStringTerm rst = (RecipientStringTerm)obj;
return rst.type.equals(this.type) && super.equals(obj);
}
|
public RecipientType getRecipientType() {
return type;
}
Return the type of recipient to match with. |
public int hashCode() {
return type.hashCode() + super.hashCode();
}
Compute a hashCode for this object. |
public boolean match(Message msg) {
Address[] recipients;
try {
recipients = msg.getRecipients(type);
} catch (Exception e) {
return false;
}
if (recipients == null)
return false;
for (int i=0; i < recipients.length; i++)
if (super.match(recipients[i]))
return true;
return false;
}
Check whether the address specified in the constructor is
a substring of the recipient address of this Message. |