MessageCountEvent (Java EE 5)

Java EE API


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
All Implemented Interfaces:
Serializable

public class MessageCountEvent
extends MailEvent

Extends: java.util.EventObject > MailEvent

此类通知文件夹中消息数量的更改。

注意,在某些时刻或某些操作之后,一些文件夹类型可能只传送 MessageCountEvent。尤其是 IMAP,当客户端发出一个新命令时,它将只通知 MessageCountEvent 的客户端。有关详细信息,请参考 RFC 2060 http://www.ietf.org/rfc/rfc2060.txt。通过不定期地调用 getMessageCountisConnected 方法,客户端可以“轮询”文件夹以请求任何形式的这类通知。

英文文档:

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.

Author:
John Mani
See Also:
Serialized Form

Field Summary
static int
protected  Message[]
protected  boolean
static int
protected  int
 
Fields inherited from class java.util.EventObject
 
Constructor Summary
 
Method Summary
 void
 Message[]
 int
 boolean
 
Methods inherited from class java.util.EventObject
 
Methods inherited from class java.lang.Object
 

Field Detail

英文文档:

ADDED

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

See Also:
Constant Field Values


英文文档:

REMOVED

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

See Also:
Constant Field Values


英文文档:

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.

Constructor Detail

public MessageCountEvent(Folder folder, int type, boolean removed, Message[] msgs)
构造方法。
folder 包含文件夹
type 事件类型
removed 如果为 true,此事件是此客户端显式擦除的结果,而且此文件夹中的消息已为此重新编号。如果为 false,则此事件是外部源擦除的结果。
msgs 添加/移除的消息
英文文档:

MessageCountEvent

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

Parameters:
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

Method Detail

public int getType()
返回此事件的类型。
return 类型
英文文档:

getType

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

Returns:
type

public boolean isRemoved()
指示此事件是此客户端显式擦除的结果还是由外部源擦除引起的。如果为 true,此事件是由显式擦除引起的,并且此文件夹中的所有剩余消息都为此重新编号。如果为 false,则此事件是由外部擦除引起的。

注意,只有当此事件的类型为 REMOVED 时,此方法才有效

英文文档:

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


public Message[] getMessages()
返回添加或移除的消息数组。
return 消息数组
英文文档:

getMessages

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

Returns:
array of messages

public void dispatch(Object listener)
调用相应的 MessageCountListener 方法。
英文文档:

dispatch

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

Specified by:
dispatch in class MailEvent


Submit a bug or feature

Copyright 2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.

一看就知道只有菜鸟才干这么无知的事啦。

PS : 未经我党受权你也可自由散发此文档。 如有任何错误请自行修正;若因此而造成任何损失请直接找人民主席,请勿与本人联系。谢谢!