Class SeNoticeToVacate

java.lang.Object
me.tayebyassine.homestead.models.serialize.SeNoticeToVacate

public final class SeNoticeToVacate extends Object
Serializable representation of a notice-to-vacate for rented regions.

Tracks when the notice was issued, how many days the renter has to vacate, and whether the renter has acknowledged the notice.

  • Constructor Details

    • SeNoticeToVacate

      public SeNoticeToVacate(long noticeAt, int daysToVacate)
      Create a new notice to vacate.
      Parameters:
      noticeAt - the timestamp when the notice was issued
      daysToVacate - the number of days the renter has to vacate
  • Method Details

    • deserialize

      public static SeNoticeToVacate deserialize(@NotNull @NotNull String serialized)
      Deserialize a notice from its semicolon-separated string form.
      Parameters:
      serialized - the string in the format noticeAt;daysToVacate;acknowledged
      Returns:
      the deserialized notice, or null on parse failure
    • getNoticeAt

      public long getNoticeAt()
      Get the timestamp when the notice was issued.
      Returns:
      the notice timestamp in milliseconds
    • setNoticeAt

      public void setNoticeAt(long noticeAt)
      Set the timestamp when the notice was issued.
      Parameters:
      noticeAt - the notice timestamp in milliseconds
    • getDaysToVacate

      public int getDaysToVacate()
      Get the number of days the renter has to vacate.
      Returns:
      the vacate period in days
    • setDaysToVacate

      public void setDaysToVacate(int daysToVacate)
      Set the number of days the renter has to vacate.
      Parameters:
      daysToVacate - the vacate period in days
    • getVacateAt

      public long getVacateAt()
      Calculate the absolute timestamp by which the renter must vacate.
      Returns:
      the vacate deadline in milliseconds
    • isAcknowledged

      public boolean isAcknowledged()
      Whether the renter has acknowledged the notice.
      Returns:
      true if acknowledged
    • setAcknowledged

      public void setAcknowledged(boolean acknowledged)
      Set whether the renter has acknowledged the notice.
      Parameters:
      acknowledged - true to mark as acknowledged
    • serialize

      public String serialize()
      Serialise the notice to a semicolon-separated string.
      Returns:
      the encoded string in the format noticeAt;daysToVacate;acknowledged
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object