FileDocCategorySizeDatePackage
MessageIDTerm.javaAPI DocJavaMail 1.4.33285Tue Nov 17 10:38:12 GMT 2009javax.mail.search

MessageIDTerm

public final class MessageIDTerm extends StringTerm
This term models the RFC822 "MessageId" - a message-id for Internet messages that is supposed to be unique per message. Clients can use this term to search a folder for a message given its MessageId.

The MessageId is represented as a String.

author
Bill Shannon
author
John Mani

Fields Summary
private static final long
serialVersionUID
Constructors Summary
public MessageIDTerm(String msgid)
Constructor.

param
msgid the msgid to search for


                  
       
	// Note: comparison is case-insensitive
	super(msgid);
    
Methods Summary
public booleanequals(java.lang.Object obj)
Equality comparison.

	if (!(obj instanceof MessageIDTerm))
	    return false;
	return super.equals(obj);
    
public booleanmatch(javax.mail.Message msg)
The match method.

param
msg the match is applied to this Message's Message-ID header
return
true if the match succeeds, otherwise false

	String[] s;

	try {
	    s = msg.getHeader("Message-ID");
	} catch (Exception e) {
	    return false;
	}

	if (s == null)
	    return false;

	for (int i=0; i < s.length; i++)
	    if (super.match(s[i]))
		return true;
	return false;