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 Duration
duration()
Returns the value of theduration
record component.end()
Gets the endInstant
of the ban.endZoned()
Gets the endZonedDateTime
of the ban in the system default zone id.Gets the endZonedDateTime
of the ban in the given zone id.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.boolean
Checks if the ban is still active (the remaining time is greater than 0).Gets the remainingDuration
of the ban.@NotNull Instant
start()
Returns the value of thestart
record component.final String
toString()
Returns a string representation of this record class.
-
Constructor Details
-
Method Details
-
end
Gets the endInstant
of the ban.- Returns:
- the end of the ban
-
endZoned
Gets the endZonedDateTime
of the ban in the given zone id.- Parameters:
zoneId
- the zone id to convert the end to- Returns:
- the end
ZonedDateTime
of the ban in the given zone id
-
endZoned
Gets the endZonedDateTime
of the ban in the system default zone id.- Returns:
- the end
ZonedDateTime
of 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 remainingDuration
of 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 thestart
record component.- Returns:
- the value of the
start
record component
-
duration
Returns the value of theduration
record component.- Returns:
- the value of the
duration
record component
-