Module jakarta.mail

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 ...).
See Also:
  • Field Details

    • pattern

      protected String pattern
      The pattern.
    • ignoreCase

      protected boolean ignoreCase
      Ignore case when comparing?
    • serialVersionUID

      private static final long serialVersionUID
      See Also:
  • Constructor Details

    • StringTerm

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

      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

    • getPattern

      public 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(String s)
    • equals

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

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