Movatterモバイル変換


[0]ホーム

URL:


         


Class Flags

java.lang.Object  |  +--javax.mail.Flags
All Implemented Interfaces:
java.lang.Cloneable

public classFlags
extends java.lang.Object
implements java.lang.Cloneable

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 theFlags.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. ThegetPermanentFlags method on a Folder returns a Flags object that holds all the flags that are supported by that folder implementation. 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");      ......      ...... }

See Also:
Folder.getPermanentFlags()

Flags.Flag
          This inner class represents an individual system flag.
 
Flags()
          Construct an empty Flags object.
Flags(Flags.Flag flag)
          Construct a Flags object initialized with the given system flag.
Flags(Flags flags)
          Construct a Flags object initialized with the given flags.
Flags(java.lang.String flag)
          Construct a Flags object initialized with the given user flag.
 
add(Flags.Flag flag)
          Add the specified system flag to this Flags object.
add(Flags f)
          Add all the flags in the given Flags object to this Flags object.
add(java.lang.String flag)
          Add the specified user flag to this Flags object.
clone()
          Returns a clone of this Flags object.
contains(Flags.Flag flag)
          Check whether the specified system flag is present in this Flags object.
contains(Flags f)
          Check whether all the flags in the specified Flags object are present in this Flags object.
contains(java.lang.String flag)
          Check whether the specified user flag is present in this Flags object.
equals(java.lang.Object obj)
          Check whether the two Flags objects are equal.
getSystemFlags()
          Return all the system flags in this Flags object.
getUserFlags()
          Return all the user flags in this Flags object.
hashCode()
          Compute a hash code for this Flags object.
remove(Flags.Flag flag)
          Remove the specified system flag from this Flags object.
remove(Flags f)
          Remove all flags in the given Flags object from this Flags object.
remove(java.lang.String flag)
          Remove the specified user flag from this Flags object.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Flags

publicFlags()
Construct an empty Flags object.

Flags

publicFlags(Flags flags)
Construct a Flags object initialized with the given flags.
Parameters:
flags - the flags for initialization

Flags

publicFlags(Flags.Flag flag)
Construct a Flags object initialized with the given system flag.
Parameters:
flag - the flag for initialization

Flags

publicFlags(java.lang.String flag)
Construct a Flags object initialized with the given user flag.
Parameters:
flag - the flag for initialization

add

public voidadd(Flags.Flag flag)
Add the specified system flag to this Flags object.
Parameters:
flag - the flag to add

add

public voidadd(java.lang.String flag)
Add the specified user flag to this Flags object.
Parameters:
flag - the flag to add

add

public voidadd(Flags f)
Add all the flags in the given Flags object to this Flags object.
Parameters:
flags - Flags object

remove

public voidremove(Flags.Flag flag)
Remove the specified system flag from this Flags object.
Parameters:
flag - the flag to be removed

remove

public voidremove(java.lang.String flag)
Remove the specified user flag from this Flags object.
Parameters:
flag - the flag to be removed

remove

public voidremove(Flags f)
Remove all flags in the given Flags object from this Flags object.
Parameters:
flag - the flag to be removed

contains

public booleancontains(Flags.Flag flag)
Check whether the specified system flag is present in this Flags object.
Returns:
true of the given flag is present, otherwise false.

contains

public booleancontains(java.lang.String flag)
Check whether the specified user flag is present in this Flags object.
Returns:
true of the given flag is present, otherwise false.

contains

public booleancontains(Flags f)
Check whether all the flags in the specified Flags object are present in this Flags object.
Returns:
true if all flags in the given Flags object are present, otherwise false.

equals

public booleanequals(java.lang.Object obj)
Check whether the two Flags objects are equal.
Overrides:
equals in classjava.lang.Object
Returns:
true if they're equal

hashCode

public inthashCode()
Compute a hash code for this Flags object.
Overrides:
hashCode in classjava.lang.Object
Returns:
the hash code

getSystemFlags

publicFlags.Flag[]getSystemFlags()
Return all the system flags in this Flags object. Returns an array of size zero if no flags are set.
Returns:
array of Flags.Flag objects representing system flags

getUserFlags

public java.lang.String[]getUserFlags()
Return all the user flags in this Flags object. Returns an array of size zero if no flags are set.
Returns:
array of Strings, each String represents a flag.

clone

public java.lang.Objectclone()
Returns a clone of this Flags object.
Overrides:
clone in classjava.lang.Object

         


[8]ページ先頭

©2009-2025 Movatter.jp