Package jakarta.mail.event
Class MessageCountEvent
java.lang.Object
java.util.EventObject
jakarta.mail.event.MailEvent
jakarta.mail.event.MessageCountEvent
- All Implemented Interfaces:
Serializable
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
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
The messages were added to their folderprotected Message[]
The messages.protected 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.static final int
The messages were removed from their folderprotected int
The event type.Fields inherited from class java.util.EventObject
source
-
Constructor Summary
ConstructorDescriptionMessageCountEvent
(Folder folder, int type, boolean removed, Message[] msgs) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Invokes the appropriate MessageCountListener method.Message[]
Return the array of messages added or removed.int
getType()
Return the type of this event.boolean
Indicates whether this event is the result of an explicit expunge by this client, or due to an expunge from external sources.Methods inherited from class java.util.EventObject
getSource, toString
-
Field Details
-
ADDED
public static final int ADDEDThe messages were added to their folder- See Also:
-
REMOVED
public static final int REMOVEDThe messages were removed from their folder- See Also:
-
type
protected int typeThe event type. -
removed
protected boolean removedIf 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.
-
-
Constructor Details
-
MessageCountEvent
Constructor.- Parameters:
folder
- The containing foldertype
- The event typeremoved
- 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 Details
-
getType
public int getType()Return the type of this event.- Returns:
- 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. Iftrue
, this event is due to an explicit expunge and hence all remaining messages in this folder have been renumbered. Iffalse
, this event is due to an external expunge.Note that this method is valid only if the type of this event is
REMOVED
- Returns:
- true if the message has been removed
-
getMessages
Return the array of messages added or removed.- Returns:
- array of messages
-
dispatch
Invokes the appropriate MessageCountListener method.
-