javax.mail.search
Class StringTerm

java.lang.Object
  extended by javax.mail.search.SearchTerm
      extended by javax.mail.search.StringTerm
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
AddressStringTerm, BodyTerm, HeaderTerm, MessageIDTerm, SubjectTerm

public abstract class StringTerm
extends SearchTerm

A Term that provides matching criteria for Strings.

Version:
$Rev: 421852 $ $Date: 2006-07-14 03:02:19 -0700 (Fri, 14 Jul 2006) $
See Also:
Serialized Form

Field Summary
protected  boolean ignoreCase
          If true, case should be ignored during matching.
protected  String pattern
          The pattern associated with this term.
 
Constructor Summary
protected StringTerm(String pattern)
          Constructor specifying a pattern.
protected 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
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ignoreCase

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


pattern

protected String pattern
The pattern associated with this term.

Constructor Detail

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 Detail

getPattern

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

Returns:
the pattern associated with this term

getIgnoreCase

public boolean getIgnoreCase()
Indicate if case should be ignored when matching.

Returns:
if true, case should be ignored during matching

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

equals

public boolean equals(Object other)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 2006 Apache Software Foundation. All Rights Reserved.