Record Class RoomScheduleItem
java.lang.Object
java.lang.Record
de.gustavblass.fsu.fmi.roombooking.model.room.schedule.RoomScheduleItem
- Record Components:
status- Whether the schedule'sRoomisRoomStatus.FREEorRoomStatus.OCCUPIED.startTime- Thestatus()is valid only after thisLocalTimefor the Room.endTime- Thestatus()is valid only before thisLocalTimefor the Room.occupancy- If set, the number of seats occupied by SeatReservations. If unset, the whole Room is reserved. UsegetOccupancy()for null-safe access.
public record RoomScheduleItem(@NonNull RoomStatus status, @NonNull LocalTime startTime, @NonNull LocalTime endTime, @Nullable @Range(from=0L,to=2147483647L) Integer occupancy)
extends Record
A single element of a
RoomSchedule.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final @NonNull LocalTimeThe field for theendTimerecord component.private final @Nullable @Range(from=0L,to=2147483647L) IntegerThe field for theoccupancyrecord component.private final @NonNull LocalTimeThe field for thestartTimerecord component.private final @NonNull RoomStatusThe field for thestatusrecord component. -
Constructor Summary
ConstructorsConstructorDescriptionRoomScheduleItem(@NonNull RoomStatus status, @NonNull LocalTime startTime, @NonNull LocalTime endTime, @Nullable @Range(from=0L,to=2147483647L) Integer occupancy) Constructs a new schedule element. -
Method Summary
Modifier and TypeMethodDescription@NonNull LocalTimeendTime()Returns the value of theendTimerecord component.final booleanIndicates whether some other object is "equal to" this one.@NonNull Durationfinal inthashCode()Returns a hash code value for this object.@Nullable @Range(from=0L,to=2147483647L) IntegerReturns the value of theoccupancyrecord component.@NonNull LocalTimeReturns the value of thestartTimerecord component.@NonNull RoomStatusstatus()Returns the value of thestatusrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
status
The field for thestatusrecord component. -
startTime
-
endTime
-
occupancy
-
-
Constructor Details
-
RoomScheduleItem
public RoomScheduleItem(@NonNull @NonNull RoomStatus status, @NonNull @NonNull LocalTime startTime, @NonNull @NonNull LocalTime endTime, @Nullable @Nullable @Range(from=0L,to=2147483647L) Integer occupancy) Constructs a new schedule element.- Parameters:
status- Thestatus.startTime- ThestartTime. Must come before theendTime!endTime- TheendTime. Must come after thestartTime!occupancy- Theoccupancy. Will be ignored if negative.- API Note:
- If the
endTimecomes before thestartTime, they will simply be swapped without throwing an exception.
-
-
Method Details
-
getOccupancy
-
getDuration
- Returns:
- The
Duration.between(Temporal, Temporal)thestartTimeandendTime.
-
toString
-
hashCode
-
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). -
status
-
startTime
-
endTime
-
occupancy
-