1 /* 2 * The contents of this file are subject to the terms 3 * of the Common Development and Distribution License 4 * (the "License"). You may not use this file except 5 * in compliance with the License. 6 * 7 * You can obtain a copy of the license at 8 * glassfish/bootstrap/legal/CDDLv1.0.txt or 9 * https://glassfish.dev.java.net/public/CDDLv1.0.html. 10 * See the License for the specific language governing 11 * permissions and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL 14 * HEADER in each file and include the License file at 15 * glassfish/bootstrap/legal/CDDLv1.0.txt. If applicable, 16 * add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your 18 * own identifying information: Portions Copyright [yyyy] 19 * [name of copyright owner] 20 */ 21 22 /* 23 * @(#)SearchTerm.java 1.7 05/08/29 24 * 25 * Copyright 1997-2005 Sun Microsystems, Inc. All Rights Reserved. 26 */ 27 28 package javax.mail.search; 29 30 import java.io.Serializable; 31 32 import javax.mail.Message; 33 34 /** 35 * Search criteria are expressed as a tree of search-terms, forming 36 * a parse-tree for the search expression. <p> 37 * 38 * Search-terms are represented by this class. This is an abstract 39 * class; subclasses implement specific match methods. <p> 40 * 41 * Search terms are serializable, which allows storing a search term 42 * between sessions. 43 * 44 * <strong>Warning:</strong> 45 * Serialized objects of this class may not be compatible with future 46 * JavaMail API releases. The current serialization support is 47 * appropriate for short term storage. <p> 48 * 49 * <strong>Warning:</strong> 50 * Search terms that include references to objects of type 51 * <code>Message.RecipientType</code> will not be deserialized 52 * correctly on JDK 1.1 systems. While these objects will be deserialized 53 * without throwing any exceptions, the resulting objects violate the 54 * <i>type-safe enum</i> contract of the <code>Message.RecipientType</code> 55 * class. Proper deserialization of these objects depends on support 56 * for the <code>readReplace</code> method, added in JDK 1.2. 57 * 58 * @author Bill Shannon 59 * @author John Mani 60 */ 61 public abstract class SearchTerm implements Serializable { 62 63 private static final long serialVersionUID = -6652358452205992789L; 64 65 /** 66 * This method applies a specific match criterion to the given 67 * message and returns the result. 68 * 69 * @param msg The match criterion is applied on this message 70 * @return true, it the match succeeds, false if the match fails 71 */ 72 73 public abstract boolean match(Message msg); 74 } 75