Class MailMessage

java.lang.Object
net.essentialsx.api.v2.services.mail.MailMessage

public class MailMessage extends Object
An immutable representation of a message sent as mail.
  • Constructor Summary

    Constructors
    Constructor
    Description
    MailMessage(boolean read, boolean legacy, String sender, UUID uuid, long timestamp, long expire, String message)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets the message content for normal mail or the entire mail format for legacy mail.
    Gets the sender's username at the time of sending the message.
    Gets the sender's UUID or null if the sender does not have a UUID.
    long
    Gets the millisecond epoch at which this message will expire and no longer been shown to the user.
    long
    Gets the millisecond epoch time when the message was sent.
    boolean
    Helper method to check if this mail has expired and should not been shown to the recipient.
    boolean
    Checks if this message was created via legacy api or converted from legacy format.
    boolean
    Checks if this message has been read by its recipient yet.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • MailMessage

      public MailMessage(boolean read, boolean legacy, String sender, UUID uuid, long timestamp, long expire, String message)
  • Method Details

    • isRead

      public boolean isRead()
      Checks if this message has been read by its recipient yet.
      Returns:
      true if this message has been read.
    • isLegacy

      public boolean isLegacy()
      Checks if this message was created via legacy api or converted from legacy format. A legacy messages only contains data for the read state and message.
      Returns:
      true if this message is a legacy message.
      See Also:
    • getSenderUsername

      public String getSenderUsername()
      Gets the sender's username at the time of sending the message.
      Returns:
      The sender's username.
    • getSenderUUID

      public UUID getSenderUUID()
      Gets the sender's UUID or null if the sender does not have a UUID.
      Returns:
      The sender's UUID or null.
    • getTimeSent

      public long getTimeSent()
      Gets the millisecond epoch time when the message was sent.
      Returns:
      The epoch time when message was sent.
    • getTimeExpire

      public long getTimeExpire()
      Gets the millisecond epoch at which this message will expire and no longer been shown to the user.
      Returns:
      The epoch time when the message will expire.
    • getMessage

      public String getMessage()
      Gets the message content for normal mail or the entire mail format for legacy mail.
      Returns:
      The mail content or format.
      See Also:
    • isExpired

      public boolean isExpired()
      Helper method to check if this mail has expired and should not been shown to the recipient.
      Returns:
      true if this mail has expired.