Class StringTerm

java.lang.Object
jakarta.mail.search.SearchTerm
jakarta.mail.search.StringTerm
All Implemented Interfaces:
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:
  • Field Summary Link icon

    Fields
    Modifier and Type
    Field
    Description
    protected boolean
    Ignore case when comparing?
    protected String
    The pattern.
  • Constructor Summary Link icon

    Constructors
    Modifier
    Constructor
    Description
    protected
    StringTerm(String pattern)
    Construct a StringTerm with the given pattern.
    protected
    StringTerm(String pattern, boolean ignoreCase)
    Construct a StringTerm with the given pattern and ignoreCase flag.
  • Method Summary Link icon

    Modifier and Type
    Method
    Description
    boolean
    Equality comparison.
    boolean
    Return true if we should ignore case when matching.
    Return the string to match with.
    int
    Compute a hashCode for this object.
    protected boolean
    The match method.

    Methods inherited from class jakarta.mail.search.SearchTerm Link icon

    match

    Methods inherited from class java.lang.Object Link icon

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Field Details Link icon

    • pattern Link icon

      protected String pattern
      The pattern.
    • ignoreCase Link icon

      protected boolean ignoreCase
      Ignore case when comparing?
  • Constructor Details Link icon

    • StringTerm Link icon

      protected StringTerm(String pattern)
      Construct a StringTerm with the given pattern. Case will be ignored.
      Parameters:
      pattern - the pattern
    • StringTerm Link icon

      protected StringTerm(String pattern, boolean ignoreCase)
      Construct a StringTerm with the given pattern and ignoreCase flag.
      Parameters:
      pattern - the pattern
      ignoreCase - should we ignore case?
  • Method Details Link icon

    • getPattern Link icon

      public String getPattern()
      Return the string to match with.
      Returns:
      the string to match
    • getIgnoreCase Link icon

      public boolean getIgnoreCase()
      Return true if we should ignore case when matching.
      Returns:
      true if we should ignore case
    • match Link icon

      protected boolean match(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 Link icon

      public boolean equals(Object obj)
      Equality comparison.
      Overrides:
      equals in class Object
    • hashCode Link icon

      public int hashCode()
      Compute a hashCode for this object.
      Overrides:
      hashCode in class Object