MessageCountEvent (Java EE 5 SDK)

Java

Java EE 5 SDK

深圳电信培训中心.徐海蛟老师.


javax.mail.event Class MessageCountEvent

java.lang.Object
  extended by java.util.EventObject
      extended by javax.mail.event.MailEvent
          extended by javax.mail.event.MessageCountEvent
所有已实现的接口:
Serializable

public class MessageCountEvent
extends MailEvent

This class notifies changes in the number of messages in a folder.

Note that some folder types may only deliver MessageCountEvents at certain times or after certain operations. IMAP in particular will only notify the client of MessageCountEvents when a client issues a new command. Refer to RFC 2060 http://www.ietf.org/rfc/rfc2060.txt for details. A client may want "poll" the folder by occasionally calling the getMessageCount or isConnected methods to solicit any such notifications.

作者:
John Mani
另请参见:
Serialized Form

字段摘要
static int ADDED
          The messages were added to their folder
protected  Message[] msgs
          The messages.
protected  boolean removed
          If true, this event is the result of an explicit expunge by this client, and the messages in this folder have been renumbered to account for this.
static int REMOVED
          The messages were removed from their folder
protected  int type
          The event type.
 
Fields inherited from class java.util.EventObject
source
 
构造器摘要
MessageCountEvent(Folder folder, int type, boolean removed, Message[] msgs)
          Constructor.
 
方法摘要
 void dispatch(Object listener)
          Invokes the appropriate MessageCountListener method.
 Message[] getMessages()
          Return the array of messages added or removed.
 int getType()
          Return the type of this event.
 boolean isRemoved()
          Indicates whether this event is the result of an explicit expunge by this client, or due to an expunge from external sources.
 
类方法继承 java.util.EventObject
getSource, toString
 
类方法继承 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

字段详细信息

ADDED

public static final int ADDED
The messages were added to their folder

另请参见:
常量字段


REMOVED

public static final int REMOVED
The messages were removed from their folder

另请参见:
常量字段


type

protected int type
The event type.


removed

protected boolean removed
If true, this event is the result of an explicit expunge by this client, and the messages in this folder have been renumbered to account for this. If false, this event is the result of an expunge by external sources.


msgs

protected transient Message[] msgs
The messages.

构造器详细信息

MessageCountEvent

public MessageCountEvent(Folder folder,
                         int type,
                         boolean removed,
                         Message[] msgs)
Constructor.

参数:
folder - The containing folder
type - The event type
removed - If true, this event is the result of an explicit expunge by this client, and the messages in this folder have been renumbered to account for this. If false, this event is the result of an expunge by external sources.
msgs - The messages added/removed

方法详细信息

getType

public int getType()
Return the type of this event.

返回:
type

isRemoved

public boolean isRemoved()
Indicates whether this event is the result of an explicit expunge by this client, or due to an expunge from external sources. If true, this event is due to an explicit expunge and hence all remaining messages in this folder have been renumbered. If false, this event is due to an external expunge.

Note that this method is valid only if the type of this event is REMOVED


getMessages

public Message[] getMessages()
Return the array of messages added or removed.

返回:
array of messages

dispatch

public void dispatch(Object listener)
Invokes the appropriate MessageCountListener method.

规范说明:
dispatch in class MailEvent

Java EE 5 SDK

深圳电信培训中心.徐海蛟老师.


提交错误或意见

版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。深圳电信培训中心.徐海蛟老师教学参考.