FileDocCategorySizeDatePackage
FromTerm.javaAPI DocGlassfish v2 API3096Mon May 14 15:28:50 BST 2007javax.mail.search

FromTerm

public final class FromTerm extends AddressTerm
This class implements comparisons for the From Address header.
author
Bill Shannon
author
John Mani

Fields Summary
private static final long
serialVersionUID
Constructors Summary
public FromTerm(Address address)
Constructor

param
address The Address to be compared


       	         
       
	super(address);
    
Methods Summary
public booleanequals(java.lang.Object obj)
Equality comparison.

	if (!(obj instanceof FromTerm))
	    return false;
	return super.equals(obj);
    
public booleanmatch(javax.mail.Message msg)
The address comparator.

param
msg The address comparison is applied to this Message
return
true if the comparison succeeds, otherwise false

	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;