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

SubjectTerm

public final class SubjectTerm extends StringTerm
This class implements comparisons for the Message Subject header. The comparison is case-insensitive.
author
Bill Shannon
author
John Mani

Fields Summary
private static final long
serialVersionUID
Constructors Summary
public SubjectTerm(String pattern)
Constructor.

param
pattern the pattern to search for


                  
       
	// Note: comparison is case-insensitive
	super(pattern);
    
Methods Summary
public booleanequals(java.lang.Object obj)
Equality comparison.

	if (!(obj instanceof SubjectTerm))
	    return false;
	return super.equals(obj);
    
public booleanmatch(javax.mail.Message msg)
The match method.

param
msg the pattern match is applied to this Message's subject header
return
true if the pattern match succeeds, otherwise false

	String subj;

	try {
	    subj = msg.getSubject();
	} catch (Exception e) {
	    return false;
	}

	if (subj == null)
	    return false;

	return super.match(subj);