All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.hubspot.imap.protocol.message.StandardMessageFlag Maven / Gradle / Ivy

There is a newer version: 0.6.1
Show newest version
package com.hubspot.imap.protocol.message;

import java.util.Optional;

public enum StandardMessageFlag implements MessageFlag {
  SEEN,
  ANSWERED,
  FLAGGED,
  DELETED,
  DRAFT,
  RECENT,
  INVALID;

  public static Optional getFlag(String name) {
    if (name.startsWith("\\") || name.startsWith("$")) {
      name = name.substring(1);
    }

    try {
      return Optional.of(StandardMessageFlag.valueOf(name.toUpperCase()));
    } catch (IllegalArgumentException e) {
      return Optional.of(new StringMessageFlag(name));
    }
  }

  public String getString() {
    return "\\" + this.name();
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy