| java.lang.Object | |
| ↳ | com.google.code.javax.mail.Flags |
Known Direct Subclasses
|
The Flags class represents the set of flags on a Message. Flags are composed of predefined system flags, and user defined flags.
A System flag is represented by the Flags.Flag
inner class. A User defined flag is represented as a String.
User flags are case-independent.
A set of standard system flags are predefined. Most folder
implementations are expected to support these flags. Some
implementations may also support arbitrary user-defined flags. The
getPermanentFlags method on a GmailFolder returns a Flags
object that holds all the flags that are supported by that folder
implementation.
A Flags object is serializable so that (for example) the use of Flags objects in search terms can be serialized along with the search terms.
Warning: Serialized objects of this class may not be compatible with future JavaMail API releases. The current serialization support is appropriate for short term storage.
The below code sample illustrates how to set, examine and get the flags for a message.
Message m = folder.getMessage(1);
m.setFlag(Flags.Flag.DELETED, true); // set the DELETED flag
// Check if DELETED flag is set of this message
if (m.isSet(Flags.Flag.DELETED))
System.out.println("DELETED message");
// Examine ALL system flags for this message
Flags flags = m.getFlags();
Flags.Flag[] sf = flags.getSystemFlags();
for (int i = 0; i < sf.length; i++) {
if (sf[i] == Flags.Flag.DELETED)
System.out.println("DELETED message");
else if (sf[i] == Flags.Flag.SEEN)
System.out.println("SEEN message");
......
......
}
| Nested Classes | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Flags.Flag | This inner class represents an individual system flag. | ||||||||||
| Constants | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| int | ANSWERED_BIT | ||||||||||
| int | DELETED_BIT | ||||||||||
| int | DRAFT_BIT | ||||||||||
| int | FLAGGED_BIT | ||||||||||
| int | RECENT_BIT | ||||||||||
| int | SEEN_BIT | ||||||||||
| int | USER_BIT | ||||||||||
| long | serialVersionUID | ||||||||||
| Fields | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| system_flags | |||||||||||
| user_flags | |||||||||||
| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Construct an empty Flags object.
| |||||||||||
Construct a Flags object initialized with the given flags.
| |||||||||||
Construct a Flags object initialized with the given system flag.
| |||||||||||
Construct a Flags object initialized with the given user flag.
| |||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Add the specified system flag to this Flags object.
| |||||||||||
Add all the flags in the given Flags object to this
Flags object.
| |||||||||||
Add the specified user flag to this Flags object.
| |||||||||||
Returns a clone of this Flags object.
| |||||||||||
Check whether the specified user flag is present in this Flags object.
| |||||||||||
Check whether the specified system flag is present in this Flags object.
| |||||||||||
Check whether all the flags in the specified Flags object are
present in this Flags object.
| |||||||||||
Check whether the two Flags objects are equal.
| |||||||||||
Return all the system flags in this Flags object.
| |||||||||||
Return all the user flags in this Flags object.
| |||||||||||
Compute a hash code for this Flags object.
| |||||||||||
Remove all flags in the given Flags object from this
Flags object.
| |||||||||||
Remove the specified system flag from this Flags object.
| |||||||||||
Remove the specified user flag from this Flags object.
| |||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
Construct an empty Flags object.
Construct a Flags object initialized with the given flags.
| flags | The flags for initialization |
|---|
Construct a Flags object initialized with the given system flag.
| flag | The flag for initialization |
|---|
Construct a Flags object initialized with the given user flag.
| flag | The flag for initialization |
|---|
Add the specified system flag to this Flags object.
| flag | The flag to add |
|---|
Add all the flags in the given Flags object to this Flags object.
| f | Flags object |
|---|
Add the specified user flag to this Flags object.
| flag | The flag to add |
|---|
Returns a clone of this Flags object.
Check whether the specified user flag is present in this Flags object.
| flag |
|---|
Check whether the specified system flag is present in this Flags object.
| flag |
|---|
Check whether all the flags in the specified Flags object are present in this Flags object.
| f |
|---|
Check whether the two Flags objects are equal.
| obj |
|---|
Return all the system flags in this Flags object. Returns an array of size zero if no flags are set.
Return all the user flags in this Flags object. Returns an array of size zero if no flags are set.
Compute a hash code for this Flags object.
Remove all flags in the given Flags object from this Flags object.
| f | The flag to be removed |
|---|
Remove the specified system flag from this Flags object.
| flag | The flag to be removed |
|---|
Remove the specified user flag from this Flags object.
| flag | The flag to be removed |
|---|