Record Class PostDTO
java.lang.Object
java.lang.Record
com.example.blogs.app.api.post.dto.PostDTO
public record PostDTO(Long id, String title, String content, String slug, String previewImageUrl, LocalDateTime createdAt, PostUserSummaryDTO author, List<PostCommentSummaryDTO> comments)
extends Record
Data transfer object representing a complete blog post with author and comments.
-
Constructor Summary
ConstructorsConstructorDescriptionPostDTO(Long id, String title, String content, String slug, String previewImageUrl, LocalDateTime createdAt, PostUserSummaryDTO author, List<PostCommentSummaryDTO> comments) Creates an instance of aPostDTOrecord class. -
Method Summary
Modifier and TypeMethodDescriptionauthor()Returns the value of theauthorrecord component.comments()Returns the value of thecommentsrecord component.content()Returns the value of thecontentrecord component.Returns the value of thecreatedAtrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.id()Returns the value of theidrecord component.Returns the value of thepreviewImageUrlrecord component.slug()Returns the value of theslugrecord component.title()Returns the value of thetitlerecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
PostDTO
public PostDTO(Long id, String title, String content, String slug, String previewImageUrl, LocalDateTime createdAt, PostUserSummaryDTO author, List<PostCommentSummaryDTO> comments) Creates an instance of aPostDTOrecord class.- Parameters:
id- the value for theidrecord componenttitle- the value for thetitlerecord componentcontent- the value for thecontentrecord componentslug- the value for theslugrecord componentpreviewImageUrl- the value for thepreviewImageUrlrecord componentcreatedAt- the value for thecreatedAtrecord componentauthor- the value for theauthorrecord componentcomments- the value for thecommentsrecord component
-
-
Method Details
-
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). -
id
Returns the value of theidrecord component.- Returns:
- the value of the
idrecord component
-
title
Returns the value of thetitlerecord component.- Returns:
- the value of the
titlerecord component
-
content
Returns the value of thecontentrecord component.- Returns:
- the value of the
contentrecord component
-
slug
Returns the value of theslugrecord component.- Returns:
- the value of the
slugrecord component
-
previewImageUrl
Returns the value of thepreviewImageUrlrecord component.- Returns:
- the value of the
previewImageUrlrecord component
-
createdAt
Returns the value of thecreatedAtrecord component.- Returns:
- the value of the
createdAtrecord component
-
author
Returns the value of theauthorrecord component.- Returns:
- the value of the
authorrecord component
-
comments
Returns the value of thecommentsrecord component.- Returns:
- the value of the
commentsrecord component
-