FileDocCategorySizeDatePackage
Mailbox.javaAPI DocExample1438Sun Sep 02 14:59:02 BST 2001chap8

Mailbox

public class Mailbox extends Object
A mailbox consists of a collection of mail folders for a particular user.

Fields Summary
private String
username
private Map
folders
public static final String
INBOX
Constructors Summary
public Mailbox(String username, Map folders)

param
username the owner of this mailbox.
param
folders a Map that contains folder names as keys, and MailFolder objects as values.


                               
         
        this.username = username;
        this.folders = folders;

        if (!this.folders.containsKey(INBOX)) {
            this.folders.put(INBOX, new ArrayList());
        }
    
Methods Summary
public booleancontainsFolder(java.lang.String folderName)

return
true if the specified folder is in this mailbox.

        return this.folders.containsKey(folderName);
    
public MailFoldergetFolder(java.lang.String folderName)

return
a specific folder, or null if folderName is invalid.

        return (MailFolder) this.folders.get(folderName);
    
public java.util.IteratorgetFolderNames()

return
an Iterator of String folder names.

        return this.folders.keySet().iterator();
    
public java.lang.StringgetUsername()

return
the owner of this mailbox.

        return this.username;