public class

MessageCountEvent

extends MailEvent
java.lang.Object
   ↳ java.util.EventObject
     ↳ com.google.code.javax.mail.event.MailEvent
       ↳ com.google.code.javax.mail.event.MessageCountEvent

Class Overview

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.

Summary

Constants
int ADDED The messages were added to their folder
int REMOVED The messages were removed from their folder
long serialVersionUID
[Expand]
Inherited Constants
From class com.google.code.javax.mail.event.MailEvent
From class java.util.EventObject
Fields
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.
protected int type The event type.
[Expand]
Inherited Fields
From class java.util.EventObject
Public Constructors
MessageCountEvent(Folder folder, int type, boolean removed, Message[] msgs)
Constructor.
Public Methods
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.
[Expand]
Inherited Methods
From class com.google.code.javax.mail.event.MailEvent
From class java.util.EventObject
From class java.lang.Object

Constants

public static final int ADDED

The messages were added to their folder

Constant Value: 1 (0x00000001)

public static final int REMOVED

The messages were removed from their folder

Constant Value: 2 (0x00000002)

private static final long serialVersionUID

Constant Value: -7447022340837897369 (0x98a6dca313f58b67)

Fields

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. If false, this event is the result of an expunge by external sources.

protected int type

The event type.

Public Constructors

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

Public Methods

public void dispatch (Object listener)

Invokes the appropriate MessageCountListener method.

Parameters
listener

public Message[] getMessages ()

Return the array of messages added or removed.

Returns
  • array of messages

public int getType ()

Return the type of this event.

Returns
  • type

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