- java.lang.Object
-
- javax.mail.FetchProfile
-
public class FetchProfile extends Object
Clients use a FetchProfile to list the Message attributes that it wishes to prefetch from the server for a range of messages.Messages obtained from a Folder are light-weight objects that typically start off as empty references to the actual messages. Such a Message object is filled in "on-demand" when the appropriate get*() methods are invoked on that particular Message. Certain server-based message access protocols (Ex: IMAP) allow batch fetching of message attributes for a range of messages in a single request. Clients that want to use message attributes for a range of Messages (Example: to display the top-level headers in a headerlist) might want to use the optimization provided by such servers. The
FetchProfile
allows the client to indicate this desire to the server.Note that implementations are not obligated to support FetchProfiles, since there might be cases where the backend service does not allow easy, efficient fetching of such profiles.
Sample code that illustrates the use of a FetchProfile is given below:
Message[] msgs = folder.getMessages(); FetchProfile fp = new FetchProfile(); fp.add(FetchProfile.Item.ENVELOPE); fp.add("X-mailer"); folder.fetch(msgs, fp);
- Author:
- John Mani, Bill Shannon
- See Also:
Folder.fetch(javax.mail.Message[], javax.mail.FetchProfile)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description static class
FetchProfile.Item
This inner class is the base class of all items that can be requested in a FetchProfile.
-
Constructor Summary
Constructors Constructor and Description FetchProfile()
Create an empty FetchProfile.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description void
add(FetchProfile.Item item)
Add the given special item as one of the attributes to be prefetched.void
add(String headerName)
Add the specified header-field to the list of attributes to be prefetched.boolean
contains(FetchProfile.Item item)
Returns true if the fetch profile contains given special item.boolean
contains(String headerName)
Returns true if the fetch profile contains given header name.String[]
getHeaderNames()
Get the names of the header-fields set in this profile.FetchProfile.Item[]
getItems()
Get the items set in this profile.
-
-
-
Method Detail
-
add
public void add(FetchProfile.Item item)
Add the given special item as one of the attributes to be prefetched.- Parameters:
item
- the special item to be fetched- See Also:
FetchProfile.Item.ENVELOPE
,FetchProfile.Item.CONTENT_INFO
,FetchProfile.Item.FLAGS
-
add
public void add(String headerName)
Add the specified header-field to the list of attributes to be prefetched.- Parameters:
headerName
- header to be prefetched
-
contains
public boolean contains(FetchProfile.Item item)
Returns true if the fetch profile contains given special item.
-
contains
public boolean contains(String headerName)
Returns true if the fetch profile contains given header name.
-
getItems
public FetchProfile.Item[] getItems()
Get the items set in this profile.- Returns:
- items set in this profile
-
getHeaderNames
public String[] getHeaderNames()
Get the names of the header-fields set in this profile.- Returns:
- headers set in this profile
-
-
Traduction non disponible
Les API Java ne sont pas encore traduites en français sur l'infobrol. Seule la version anglaise est disponible pour l'instant.
Version en cache
21/08/2025 17:17:56 Cette version de la page est en cache (à la date du 21/08/2025 17:17:56) afin d'accélérer le traitement.Vous pouvez activer le mode utilisateur dans le menu en haut pour afficher la version plus récente de la page.
Document créé le 14/04/2008, dernière modification le 18/08/2025
Source du document imprimé : https://www.gaudry.be/java-api-javaee-rf-javax/mail/fetchprofile.html
L'infobrol est un site personnel dont le contenu n'engage que moi. Le texte est mis à disposition sous licence CreativeCommons(BY-NC-SA). Plus d'info sur les conditions d'utilisation et sur l'auteur.
Références
Ces références et liens indiquent des documents consultés lors de la rédaction de cette page, ou qui peuvent apporter un complément d'information, mais les auteurs de ces sources ne peuvent être tenus responsables du contenu de cette page.
L'auteur de ce site est seul responsable de la manière dont sont présentés ici les différents concepts, et des libertés qui sont prises avec les ouvrages de référence. N'oubliez pas que vous devez croiser les informations de sources multiples afin de diminuer les risques d'erreurs.