javax.mail.search

Class StringTerm

Implemented Interfaces:
Serializable
Known Direct Subclasses:
AddressStringTerm, BodyTerm, HeaderTerm, MessageIDTerm, SubjectTerm

public abstract class StringTerm
extends SearchTerm

A Term that provides matching criteria for Strings.

Field Summary

protected boolean
ignoreCase
If true, case should be ignored during matching.
protected String
pattern
The pattern associated with this term.

Constructor Summary

StringTerm(String pattern)
Constructor specifying a pattern.
StringTerm(String pattern, boolean ignoreCase)
Constructor specifying pattern and case sensitivity.

Method Summary

boolean
equals(Object other)
boolean
getIgnoreCase()
Indicate if case should be ignored when matching.
String
getPattern()
Return the pattern associated with this term.
int
hashCode()
protected boolean
match(String match)
Determine if the pattern associated with this term is a substring of the supplied String.

Methods inherited from class javax.mail.search.SearchTerm

match

Field Details

ignoreCase

protected boolean ignoreCase
If true, case should be ignored during matching.

pattern

protected String pattern
The pattern associated with this term.

Constructor Details

StringTerm

protected StringTerm(String pattern)
Constructor specifying a pattern. Defaults to case insensitive matching.
Parameters:
pattern - the pattern for this term

StringTerm

protected StringTerm(String pattern,
                     boolean ignoreCase)
Constructor specifying pattern and case sensitivity.
Parameters:
pattern - the pattern for this term
ignoreCase - if true, case should be ignored during matching

Method Details

equals

public boolean equals(Object other)

getIgnoreCase

public boolean getIgnoreCase()
Indicate if case should be ignored when matching.
Returns:
if true, case should be ignored during matching

getPattern

public String getPattern()
Return the pattern associated with this term.
Returns:
the pattern associated with this term

hashCode

public int hashCode()

match

protected boolean match(String match)
Determine if the pattern associated with this term is a substring of the supplied String. If ignoreCase is true then case will be ignored.
Parameters:
match - the String to compare to
Returns:
true if this patter is a substring of the supplied String