javax.mail.search
public final class: RecipientTerm [javadoc |
source]
java.lang.Object
javax.mail.search.SearchTerm
javax.mail.search.AddressTerm
javax.mail.search.RecipientTerm
All Implemented Interfaces:
Serializable
This class implements comparisons for the Recipient Address headers.
- author:
Bill
- Shannon
- author:
John
- Mani
Field Summary |
---|
protected RecipientType | type | The recipient type. |
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.RecipientTerm Detail: |
public boolean equals(Object obj) {
if (!(obj instanceof RecipientTerm))
return false;
RecipientTerm rt = (RecipientTerm)obj;
return rt.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;
}
|