FileDocCategorySizeDatePackage
SubjectTerm.javaAPI DocJavaMail 1.4.33156Tue Nov 17 10:38:12 GMT 2009javax.mail.search

SubjectTerm

public final class SubjectTerm extends StringTerm
This class implements comparisons for the message Subject header. The comparison is case-insensitive. The pattern is a simple string that must appear as a substring in the Subject.
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);