Record Class PostCreateRequestDTO
java.lang.Object
java.lang.Record
com.example.blogs.app.api.post.dto.PostCreateRequestDTO
public record PostCreateRequestDTO(@NotBlank(message="Title must not be blank") String title, @NotBlank(message="Description must not be blank") String description, @NotBlank(message="Content must not be blank") String content)
extends Record
Request data transfer object for creating a new post with title, description, and content.
-
Constructor Summary
ConstructorsConstructorDescriptionPostCreateRequestDTO(@NotBlank(message="Title must not be blank") String title, @NotBlank(message="Description must not be blank") String description, @NotBlank(message="Content must not be blank") String content) Creates an instance of aPostCreateRequestDTOrecord class. -
Method Summary
Modifier and TypeMethodDescription@NotBlank(message="Content must not be blank") Stringcontent()Returns the value of thecontentrecord component.@NotBlank(message="Description must not be blank") StringReturns the value of thedescriptionrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.@NotBlank(message="Title must not be blank") Stringtitle()Returns the value of thetitlerecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
PostCreateRequestDTO
public PostCreateRequestDTO(@NotBlank(message="Title must not be blank") @NotBlank(message="Title must not be blank") String title, @NotBlank(message="Description must not be blank") @NotBlank(message="Description must not be blank") String description, @NotBlank(message="Content must not be blank") @NotBlank(message="Content must not be blank") String content) Creates an instance of aPostCreateRequestDTOrecord class.- Parameters:
title- the value for thetitlerecord componentdescription- the value for thedescriptionrecord componentcontent- the value for thecontentrecord 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). -
title
@NotBlank(message="Title must not be blank") public @NotBlank(message="Title must not be blank") String title()Returns the value of thetitlerecord component.- Returns:
- the value of the
titlerecord component
-
description
@NotBlank(message="Description must not be blank") public @NotBlank(message="Description must not be blank") String description()Returns the value of thedescriptionrecord component.- Returns:
- the value of the
descriptionrecord component
-
content
@NotBlank(message="Content must not be blank") public @NotBlank(message="Content must not be blank") String content()Returns the value of thecontentrecord component.- Returns:
- the value of the
contentrecord component
-