1. /*
  2. * Copyright 2002 Sun Microsystems, Inc. All rights reserved.
  3. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  4. */
  5. package javax.mail.search;
  6. import java.io.Serializable;
  7. import javax.mail.Message;
  8. /**
  9. * Search criteria are expressed as a tree of search-terms, forming
  10. * a parse-tree for the search expression. <p>
  11. *
  12. * Search-terms are represented by this class. This is an abstract
  13. * class; subclasses implement specific match methods. <p>
  14. *
  15. * Search terms are serializable, which allows storing a search term
  16. * between sessions.
  17. *
  18. * <strong>Warning:</strong>
  19. * Serialized objects of this class may not be compatible with future
  20. * JavaMail API releases. The current serialization support is
  21. * appropriate for short term storage. <p>
  22. *
  23. * <strong>Warning:</strong>
  24. * Search terms that include references to objects of type
  25. * <code>Message.RecipientType</code> will not be deserialized
  26. * correctly on JDK 1.1 systems. While these objects will be deserialized
  27. * without throwing any exceptions, the resulting objects violate the
  28. * <i>type-safe enum</i> contract of the <code>Message.RecipientType</code>
  29. * class. Proper deserialization of these objects depends on support
  30. * for the <code>readReplace</code> method, added in JDK 1.2.
  31. *
  32. * @author Bill Shannon
  33. * @author John Mani
  34. */
  35. public abstract class SearchTerm implements Serializable {
  36. /**
  37. * This method applies a specific match criterion to the given
  38. * message and returns the result.
  39. *
  40. * @param msg The match criterion is applied on this message
  41. * @return true, it the match succeeds, false if the match fails
  42. */
  43. public abstract boolean match(Message msg);
  44. }