Record Class NotificationDTO

java.lang.Object
java.lang.Record
edu.ntnu.idatt2106_2023_06.backend.dto.notification.NotificationDTO
Record Components:
notificationId - The ID of the notification
isRead - Whether the notification has been read or not
itemName - The name of the item the notification concerns
expirationDate - The expiration date of the item
fridgeId - The fridge all of this information pertains to

public record NotificationDTO(@NonNull Long notificationId, @NonNull Boolean isRead, @NonNull String itemName, @NonNull String expirationDate, @NonNull Long fridgeId) extends Record
This record represents a DTO for a notification.
  • Constructor Details

    • NotificationDTO

      public NotificationDTO(@NonNull @NonNull Long notificationId, @NonNull @NonNull Boolean isRead, @NonNull @NonNull String itemName, @NonNull @NonNull String expirationDate, @NonNull @NonNull Long fridgeId)
      Creates an instance of a NotificationDTO record class.
      Parameters:
      notificationId - the value for the notificationId record component
      isRead - the value for the isRead record component
      itemName - the value for the itemName record component
      expirationDate - the value for the expirationDate record component
      fridgeId - the value for the fridgeId record component
  • Method Details

    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • notificationId

      @NonNull public @NonNull Long notificationId()
      Returns the value of the notificationId record component.
      Returns:
      the value of the notificationId record component
    • isRead

      @NonNull public @NonNull Boolean isRead()
      Returns the value of the isRead record component.
      Returns:
      the value of the isRead record component
    • itemName

      @NonNull public @NonNull String itemName()
      Returns the value of the itemName record component.
      Returns:
      the value of the itemName record component
    • expirationDate

      @NonNull public @NonNull String expirationDate()
      Returns the value of the expirationDate record component.
      Returns:
      the value of the expirationDate record component
    • fridgeId

      @NonNull public @NonNull Long fridgeId()
      Returns the value of the fridgeId record component.
      Returns:
      the value of the fridgeId record component