Enum Class Flag

java.lang.Object
java.lang.Enum<Flag>
org.bluezoo.gumdrop.mailbox.Flag
All Implemented Interfaces:
Serializable, Comparable<Flag>, Constable

public enum Flag extends Enum<Flag>
Enumeration of standard IMAP message flags.

These flags are defined in RFC 9051 (IMAP4rev2) Section 2.3.2. While the IMAP specification theoretically allows for custom flags, in practice only these standard flags are widely used and understood.

Author:
Chris Burdess
See Also:
  • Enum Constant Details

    • SEEN

      public static final Flag SEEN
      Message has been read. IMAP atom: \Seen
    • ANSWERED

      public static final Flag ANSWERED
      Message has been answered. IMAP atom: \Answered
    • FLAGGED

      public static final Flag FLAGGED
      Message is flagged for urgent/special attention. IMAP atom: \Flagged
    • DELETED

      public static final Flag DELETED
      Message is marked for deletion. The message will be permanently removed when the mailbox is expunged. IMAP atom: \Deleted
    • DRAFT

      public static final Flag DRAFT
      Message is a draft (incomplete composition). IMAP atom: \Draft
    • RECENT

      public static final Flag RECENT
      Message is "recent" - this is the first session to be notified about this message. This flag is read-only and cannot be altered by the client. IMAP atom: \Recent
  • Method Details

    • values

      public static Flag[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static Flag valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getImapAtom

      public String getImapAtom()
      Returns the IMAP atom representation of this flag. For example, SEEN returns "\\Seen".
      Returns:
      the IMAP flag atom
    • fromImapAtom

      public static Flag fromImapAtom(String atom)
      Parses an IMAP flag atom string to the corresponding Flag enum value. The comparison is case-insensitive.
      Parameters:
      atom - the IMAP flag atom (e.g., "\\Seen", "\\SEEN", "\\seen")
      Returns:
      the corresponding Flag, or null if not recognized
    • permanentFlags

      public static Set<Flag> permanentFlags()
      Returns the set of all permanent flags. Permanent flags are those that can be stored persistently. This excludes RECENT which is session-specific and read-only.
      Returns:
      set of permanent flags
    • allFlags

      public static Set<Flag> allFlags()
      Returns the set of all flags.
      Returns:
      set of all flags
    • toString

      public String toString()
      Overrides:
      toString in class Enum<Flag>