- java.lang.Object
-
- jakarta.mail.search.SearchTerm
-
- jakarta.mail.search.StringTerm
-
- All Implemented Interfaces:
java.io.Serializable
- Direct Known Subclasses:
AddressStringTerm
,BodyTerm
,HeaderTerm
,MessageIDTerm
,SubjectTerm
public abstract class StringTerm extends SearchTerm
This class implements the match method for Strings. The current implementation provides only for substring matching. We could add comparisons (like strcmp ...).- Author:
- Bill Shannon, John Mani
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
ignoreCase
Ignore case when comparing?protected java.lang.String
pattern
The pattern.
-
Constructor Summary
Constructors Modifier Constructor Description protected
StringTerm(java.lang.String pattern)
Construct a StringTerm with the given pattern.protected
StringTerm(java.lang.String pattern, boolean ignoreCase)
Construct a StringTerm with the given pattern and ignoreCase flag.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
Equality comparison.boolean
getIgnoreCase()
Return true if we should ignore case when matching.java.lang.String
getPattern()
Return the string to match with.int
hashCode()
Compute a hashCode for this object.protected boolean
match(java.lang.String s)
The match method.-
Methods inherited from class jakarta.mail.search.SearchTerm
match
-
-
-
-
Constructor Detail
-
StringTerm
protected StringTerm(java.lang.String pattern)
Construct a StringTerm with the given pattern. Case will be ignored.- Parameters:
pattern
- the pattern
-
StringTerm
protected StringTerm(java.lang.String pattern, boolean ignoreCase)
Construct a StringTerm with the given pattern and ignoreCase flag.- Parameters:
pattern
- the patternignoreCase
- should we ignore case?
-
-
Method Detail
-
getPattern
public java.lang.String getPattern()
Return the string to match with.- Returns:
- the string to match
-
getIgnoreCase
public boolean getIgnoreCase()
Return true if we should ignore case when matching.- Returns:
- true if we should ignore case
-
match
protected boolean match(java.lang.String s)
The match method.- Parameters:
s
- The pattern search is applied on given String- Returns:
- true if given string matches this pattern; otherwise false
-
equals
public boolean equals(java.lang.Object obj)
Equality comparison.- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
Compute a hashCode for this object.- Overrides:
hashCode
in classjava.lang.Object
-
-