Top Description Fields Constructors Methods
javax.mail.event

public Class FolderEvent

extends MailEvent
Class Inheritance
Imports
java.util.*, javax.mail.*

This class models Folder existence events. FolderEvents are delivered to FolderListeners registered on the affected Folder as well as the containing Store.

Service providers vary widely in their ability to notify clients of these events. At a minimum, service providers must notify listeners registered on the same Store or Folder object on which the operation occurs. Service providers may also notify listeners when changes are made through operations on other objects in the same virtual machine, or by other clients in the same or other hosts. Such notifications are not required and are typically not supported by mail protocols (including IMAP).

Authors
John Mani, Bill Shannon

Field Summary

Modifier and TypeField and Description
public static final int
CREATED

The folder was created.

public static final int
DELETED

The folder was deleted.

protected transient Folder
folder

The folder the event occurred on.

protected transient Folder
newFolder

The folder that represents the new name, in case of a RENAMED event.

public static final int
RENAMED

The folder was renamed.

private static final long
protected int
type

The event type.

Constructor Summary

AccessConstructor and Description
public
FolderEvent(Object
The source of the event
source
,
Folder
The affected folder
folder
,
int
The event type
type
)

Constructor.

public
FolderEvent(Object
The source of the event
source
,
Folder
The folder that is renamed
oldFolder
,
Folder
The folder that represents the new name
newFolder
,
int
The event type
type
)

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 FolderListener method
public Folder

Returns:

the affected folder
getFolder
()

Return the affected folder.

public Folder

Returns:

Folder representing the new name.
getNewFolder
()

If this event indicates that a folder is renamed, (i.e, the event type is RENAMED), then this method returns the Folder object representing the new name.

public int

Returns:

type
getType
()

Return the type of this event.

Field Detail

CREATEDback to summary
public static final int CREATED

The folder was created.

DELETEDback to summary
public static final int DELETED

The folder was deleted.

folderback to summary
protected transient Folder folder

The folder the event occurred on.

newFolderback to summary
protected transient Folder newFolder

The folder that represents the new name, in case of a RENAMED event.

Since
JavaMail 1.1
RENAMEDback to summary
public static final int RENAMED

The folder was renamed.

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

FolderEventback to summary
public FolderEvent(Object source, Folder folder, int type)

Constructor.

Parameters
source:Object

The source of the event

folder:Folder

The affected folder

type:int

The event type

FolderEventback to summary
public FolderEvent(Object source, Folder oldFolder, Folder newFolder, int type)

Constructor. Use for RENAMED events.

Parameters
source:Object

The source of the event

oldFolder:Folder

The folder that is renamed

newFolder:Folder

The folder that represents the new name

type:int

The event type

Since
JavaMail 1.1

Method Detail

dispatchback to summary
public void dispatch(Object listener)

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

Invokes the appropriate FolderListener method

Parameters
listener:Object

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

the listener to invoke on

Annotations
@Override
getFolderback to summary
public Folder getFolder()

Return the affected folder.

Returns:Folder

the affected folder

See Also
getNewFolder
getNewFolderback to summary
public Folder getNewFolder()

If this event indicates that a folder is renamed, (i.e, the event type is RENAMED), then this method returns the Folder object representing the new name.

The getFolder() method returns the folder that is renamed.

Returns:Folder

Folder representing the new name.

Since
JavaMail 1.1
See Also
getFolder
getTypeback to summary
public int getType()

Return the type of this event.

Returns:int

type