Top Description Fields Constructors Methods
javax.mail.event

public Class MessageCountEvent

extends MailEvent
Class Inheritance
Known Direct Subclasses
com.sun.mail.imap.MessageVanishedEvent
Imports
java.util.*, javax.mail.*

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 3501 for details. A client may want to "poll" the folder by occasionally calling the getMessageCount or isOpen methods to solicit any such notifications.

Author
John Mani

Field Summary

Modifier and TypeField and Description
public static final int
ADDED

The messages were added to their folder

protected transient Message[]
msgs

The messages.

public static final int
REMOVED

The messages were removed from their folder

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.

private static final long
protected int
type

The event type.

Constructor Summary

AccessConstructor and Description
public
MessageCountEvent(Folder
The containing folder
folder
,
int
The event type
type
,
boolean
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.
removed
,
Message[]
The messages added/removed
msgs
)

Constructor.

Method Summary

Modifier and TypeMethod and Description
public void
dispatch(Object
the listener to invoke on
listener
)

Implements abstract javax.mail.event.MailEvent.dispatch.

Invokes the appropriate MessageCountListener method.
public Message[]

Returns:

array of messages
getMessages
()

Return the array of messages added or removed.

public int

Returns:

type
getType
()

Return the type of this event.

public boolean

Returns:

true if the message has been removed
isRemoved
()

Indicates whether this event is the result of an explicit expunge by this client, or due to an expunge from external sources.

Field Detail

ADDEDback to summary
public static final int ADDED

The messages were added to their folder

msgsback to summary
protected transient Message[] msgs

The messages.

REMOVEDback to summary
public static final int REMOVED

The messages were removed from their folder

removedback to summary
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.

serialVersionUIDback to summary
private static final long serialVersionUID

Hides javax.mail.event.MailEvent.serialVersionUID.

typeback to summary
protected int type

The event type.

Constructor Detail

MessageCountEventback to summary
public MessageCountEvent(Folder folder, int type, boolean removed, Message[] msgs)

Constructor.

Parameters
folder:Folder

The containing folder

type:int

The event type

removed:boolean

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:Message[]

The messages added/removed

Method Detail

dispatchback to summary
public void dispatch(Object listener)

Implements abstract javax.mail.event.MailEvent.dispatch.

Invokes the appropriate MessageCountListener method.

Parameters
listener:Object

Doc from javax.mail.event.MailEvent.dispatch.

the listener to invoke on

Annotations
@Override
getMessagesback to summary
public Message[] getMessages()

Return the array of messages added or removed.

Returns:Message[]

array of messages

getTypeback to summary
public int getType()

Return the type of this event.

Returns:int

type

isRemovedback to summary
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

Returns:boolean

true if the message has been removed