Class SeNoticeToVacate
java.lang.Object
me.tayebyassine.homestead.models.serialize.SeNoticeToVacate
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 Summary
ConstructorsConstructorDescriptionSeNoticeToVacate(long noticeAt, int daysToVacate) Create a new notice to vacate. -
Method Summary
Modifier and TypeMethodDescriptionstatic SeNoticeToVacatedeserialize(@NotNull String serialized) Deserialize a notice from its semicolon-separated string form.booleanintGet the number of days the renter has to vacate.longGet the timestamp when the notice was issued.longCalculate the absolute timestamp by which the renter must vacate.inthashCode()booleanWhether the renter has acknowledged the notice.Serialise the notice to a semicolon-separated string.voidsetAcknowledged(boolean acknowledged) Set whether the renter has acknowledged the notice.voidsetDaysToVacate(int daysToVacate) Set the number of days the renter has to vacate.voidsetNoticeAt(long noticeAt) Set the timestamp when the notice was issued.toString()
-
Constructor Details
-
SeNoticeToVacate
public SeNoticeToVacate(long noticeAt, int daysToVacate) Create a new notice to vacate.- Parameters:
noticeAt- the timestamp when the notice was issueddaysToVacate- the number of days the renter has to vacate
-
-
Method Details
-
deserialize
Deserialize a notice from its semicolon-separated string form.- Parameters:
serialized- the string in the formatnoticeAt;daysToVacate;acknowledged- Returns:
- the deserialized notice, or
nullon 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:
trueif acknowledged
-
setAcknowledged
public void setAcknowledged(boolean acknowledged) Set whether the renter has acknowledged the notice.- Parameters:
acknowledged-trueto mark as acknowledged
-
serialize
Serialise the notice to a semicolon-separated string.- Returns:
- the encoded string in the format
noticeAt;daysToVacate;acknowledged
-
toString
-
equals
-
hashCode
-