Record Class EventPostDTO

java.lang.Object
java.lang.Record
io.github.navjotsrakhra.eventmanager.dataModel.dto.EventPostDTO

public record EventPostDTO(Long ID, String title, String content, String location, LocalDate startDay, LocalDate endDay, LocalTime startTime, LocalTime endTime) extends Record
The EventPostDTO class represents an exposed version of an EventPost, providing a simplified interface for creating event posts.
  • Constructor Details

    • EventPostDTO

      public EventPostDTO(Long ID, String title, String content, String location, LocalDate startDay, LocalDate endDay, LocalTime startTime, LocalTime endTime)
      Creates an instance of a EventPostDTO record class.
      Parameters:
      ID - the value for the ID record component
      title - the value for the title record component
      content - the value for the content record component
      location - the value for the location record component
      startDay - the value for the startDay record component
      endDay - the value for the endDay record component
      startTime - the value for the startTime record component
      endTime - the value for the endTime record component
  • Method Details

    • toEventPost

      public EventPost toEventPost() throws DateValidationFailedException
      Converts this EventPostRecord to an EventPost object.
      Returns:
      EventPost object created from the EventPostRecord.
      Throws:
      DateValidationFailedException - if date validation fails.
    • 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.
    • ID

      public Long ID()
      Returns the value of the ID record component.
      Returns:
      the value of the ID record component
    • title

      public String title()
      Returns the value of the title record component.
      Returns:
      the value of the title record component
    • content

      public String content()
      Returns the value of the content record component.
      Returns:
      the value of the content record component
    • location

      public String location()
      Returns the value of the location record component.
      Returns:
      the value of the location record component
    • startDay

      public LocalDate startDay()
      Returns the value of the startDay record component.
      Returns:
      the value of the startDay record component
    • endDay

      public LocalDate endDay()
      Returns the value of the endDay record component.
      Returns:
      the value of the endDay record component
    • startTime

      public LocalTime startTime()
      Returns the value of the startTime record component.
      Returns:
      the value of the startTime record component
    • endTime

      public LocalTime endTime()
      Returns the value of the endTime record component.
      Returns:
      the value of the endTime record component