javax.mail.search

## Class StringTerm

- java.lang.Object
- - javax.mail.search.SearchTerm
  - - javax.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:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected boolean` | `ignoreCase` Ignore case when comparing?
    `protected String` | `pattern` The pattern.

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and 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

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(Object obj)` Equality comparison.
    `boolean` | `getIgnoreCase()` Return true if we should ignore case when matching.
    `String` | `getPattern()` Return the string to match with.
    `int` | `hashCode()` Compute a hashCode for this object.
    `protected boolean` | `match(String s)`

    - ### 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

    - #### pattern

          protected String pattern

      The pattern.

    - #### ignoreCase

          protected boolean ignoreCase

      Ignore case when comparing?

  - ### Constructor Detail

    - #### 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 Detail

    - #### 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`

Copyright © 1996-2013, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.