javax.mail.event

Class MessageCountEvent

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

    Author:
    John Mani
    See Also:
    Serialized Form
    • 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

      • 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

      • 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. 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.
        Returns:
        array of messages
      • dispatch

        public void dispatch(Object listener)
        Invokes the appropriate MessageCountListener method.
        Specified by:
        dispatch in class MailEvent

Document created the 11/06/2005, last modified the 18/08/2025
Source of the printed document:https://www.gaudry.be/en/java-api-javaee-rf-javax/mail/event/MessageCountEvent.html

The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.

References

  1. View the html document Language of the document:fr Manuel PHP : https://docs.oracle.com, MessageCountEvent (Java(TM) EE 7 Specification APIs)

These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author of this site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.