Record Class LifestealerUser.Ban
java.lang.Object
java.lang.Record
dev.chicoferreira.lifestealer.user.LifestealerUser.Ban
- Record Components:
start- the start of the banduration- the duration of the ban
- Enclosing class:
LifestealerUser
public static record LifestealerUser.Ban(@NotNull Instant start, @NotNull Duration duration)
extends Record
A record containing information about a ban.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@NotNull Durationduration()Returns the value of thedurationrecord component.end()Gets the endInstantof the ban.endZoned()Gets the endZonedDateTimeof the ban in the system default zone id.Gets the endZonedDateTimeof the ban in the given zone id.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanChecks if the ban is still active (the remaining time is greater than 0).Gets the remainingDurationof the ban.@NotNull Instantstart()Returns the value of thestartrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Method Details
-
end
Gets the endInstantof the ban.- Returns:
- the end of the ban
-
endZoned
Gets the endZonedDateTimeof the ban in the given zone id.- Parameters:
zoneId- the zone id to convert the end to- Returns:
- the end
ZonedDateTimeof the ban in the given zone id
-
endZoned
Gets the endZonedDateTimeof the ban in the system default zone id.- Returns:
- the end
ZonedDateTimeof the ban in the system default zone id
-
isBanActive
public boolean isBanActive()Checks if the ban is still active (the remaining time is greater than 0).- Returns:
- true if the ban is still active, otherwise false
-
remaining
Gets the remainingDurationof the ban.- Returns:
- the remaining time of the ban
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
start
Returns the value of thestartrecord component.- Returns:
- the value of the
startrecord component
-
duration
Returns the value of thedurationrecord component.- Returns:
- the value of the
durationrecord component
-