Record Class GoalResponseDTO
java.lang.Object
java.lang.Record
org.ntnu.idi.idatt2106.sparesti.sparestibackend.dto.goal.GoalResponseDTO
- Record Components:
id- Id of goaltitle- Title of goalsaved- Saved amounttarget- Target amountcompletion- Completion percentagedescription- Descriptionpriority- Goal prioritycreatedOn- Created on datecompletedOn- Completed on datedue- Due date
- All Implemented Interfaces:
Serializable
public record GoalResponseDTO(@NotNull(message="ID cannot be null") Long id, @NotNull(message="Title cannot be null") @NotEmpty(message="Title cannot be empty") @NotBlank(message="Title cannot be blank") String title, @NotNull(message="Saved amount cannot be null") @PositiveOrZero(message="Saved amount cannot be negative") BigDecimal saved, @NotNull(message="Target amount cannot be null") @Positive(message="Target amount cannot be less than or equal to zero") BigDecimal target, @NotNull(message="Completion amount cannot be null") @PositiveOrZero(message="Completion amount cannot be negative") BigDecimal completion, @NotNull(message="Description cannot be null") @NotEmpty(message="Description cannot be empty") @NotBlank(message="Description cannot be blank") String description, @NotNull(message="Priority cannot be null") @PositiveOrZero(message="Priority cannot be negative") Long priority, @Past(message="Created date must be in the past") ZonedDateTime createdOn, @Future(message="Completed date must be in the future") ZonedDateTime completedOn, @Future(message="Due date must be in the future") ZonedDateTime due)
extends Record
implements Serializable
DTO for
Goal- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionGoalResponseDTO(@NotNull(message="ID cannot be null") Long id, @NotNull(message="Title cannot be null") @NotEmpty(message="Title cannot be empty") @NotBlank(message="Title cannot be blank") String title, @NotNull(message="Saved amount cannot be null") @PositiveOrZero(message="Saved amount cannot be negative") BigDecimal saved, @NotNull(message="Target amount cannot be null") @Positive(message="Target amount cannot be less than or equal to zero") BigDecimal target, @NotNull(message="Completion amount cannot be null") @PositiveOrZero(message="Completion amount cannot be negative") BigDecimal completion, @NotNull(message="Description cannot be null") @NotEmpty(message="Description cannot be empty") @NotBlank(message="Description cannot be blank") String description, @NotNull(message="Priority cannot be null") @PositiveOrZero(message="Priority cannot be negative") Long priority, @Past(message="Created date must be in the past") ZonedDateTime createdOn, @Future(message="Completed date must be in the future") ZonedDateTime completedOn, @Future(message="Due date must be in the future") ZonedDateTime due) Creates an instance of aGoalResponseDTOrecord class. -
Method Summary
Modifier and TypeMethodDescription@Future(message="Completed date must be in the future") ZonedDateTimeReturns the value of thecompletedOnrecord component.@NotNull(message="Completion amount cannot be null") @PositiveOrZero(message="Completion amount cannot be negative") BigDecimalReturns the value of thecompletionrecord component.@Past(message="Created date must be in the past") ZonedDateTimeReturns the value of thecreatedOnrecord component.@NotNull(message="Description cannot be null") @NotEmpty(message="Description cannot be empty") @NotBlank(message="Description cannot be blank") StringReturns the value of thedescriptionrecord component.@Future(message="Due date must be in the future") ZonedDateTimedue()Returns the value of theduerecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.@NotNull(message="ID cannot be null") Longid()Returns the value of theidrecord component.@NotNull(message="Priority cannot be null") @PositiveOrZero(message="Priority cannot be negative") Longpriority()Returns the value of thepriorityrecord component.@NotNull(message="Saved amount cannot be null") @PositiveOrZero(message="Saved amount cannot be negative") BigDecimalsaved()Returns the value of thesavedrecord component.@NotNull(message="Target amount cannot be null") @Positive(message="Target amount cannot be less than or equal to zero") BigDecimaltarget()Returns the value of thetargetrecord component.@NotNull(message="Title cannot be null") @NotEmpty(message="Title cannot be empty") @NotBlank(message="Title cannot be blank") Stringtitle()Returns the value of thetitlerecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
GoalResponseDTO
public GoalResponseDTO(@NotNull(message="ID cannot be null") @NotNull(message="ID cannot be null") Long id, @NotNull(message="Title cannot be null") @NotEmpty(message="Title cannot be empty") @NotBlank(message="Title cannot be blank") @NotNull(message="Title cannot be null") @NotEmpty(message="Title cannot be empty") @NotBlank(message="Title cannot be blank") String title, @NotNull(message="Saved amount cannot be null") @PositiveOrZero(message="Saved amount cannot be negative") @NotNull(message="Saved amount cannot be null") @PositiveOrZero(message="Saved amount cannot be negative") BigDecimal saved, @NotNull(message="Target amount cannot be null") @Positive(message="Target amount cannot be less than or equal to zero") @NotNull(message="Target amount cannot be null") @Positive(message="Target amount cannot be less than or equal to zero") BigDecimal target, @NotNull(message="Completion amount cannot be null") @PositiveOrZero(message="Completion amount cannot be negative") @NotNull(message="Completion amount cannot be null") @PositiveOrZero(message="Completion amount cannot be negative") BigDecimal completion, @NotNull(message="Description cannot be null") @NotEmpty(message="Description cannot be empty") @NotBlank(message="Description cannot be blank") @NotNull(message="Description cannot be null") @NotEmpty(message="Description cannot be empty") @NotBlank(message="Description cannot be blank") String description, @NotNull(message="Priority cannot be null") @PositiveOrZero(message="Priority cannot be negative") @NotNull(message="Priority cannot be null") @PositiveOrZero(message="Priority cannot be negative") Long priority, @Past(message="Created date must be in the past") @Past(message="Created date must be in the past") ZonedDateTime createdOn, @Future(message="Completed date must be in the future") @Future(message="Completed date must be in the future") ZonedDateTime completedOn, @Future(message="Due date must be in the future") @Future(message="Due date must be in the future") ZonedDateTime due) Creates an instance of aGoalResponseDTOrecord class.- Parameters:
id- the value for theidrecord componenttitle- the value for thetitlerecord componentsaved- the value for thesavedrecord componenttarget- the value for thetargetrecord componentcompletion- the value for thecompletionrecord componentdescription- the value for thedescriptionrecord componentpriority- the value for thepriorityrecord componentcreatedOn- the value for thecreatedOnrecord componentcompletedOn- the value for thecompletedOnrecord componentdue- the value for theduerecord 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
@NotNull(message="Title cannot be null") @NotEmpty(message="Title cannot be empty") @NotBlank(message="Title cannot be blank") public @NotNull(message="Title cannot be null") @NotEmpty(message="Title cannot be empty") @NotBlank(message="Title cannot be blank") String title()Returns the value of thetitlerecord component.- Returns:
- the value of the
titlerecord component
-
saved
@NotNull(message="Saved amount cannot be null") @PositiveOrZero(message="Saved amount cannot be negative") public @NotNull(message="Saved amount cannot be null") @PositiveOrZero(message="Saved amount cannot be negative") BigDecimal saved()Returns the value of thesavedrecord component.- Returns:
- the value of the
savedrecord component
-
target
@NotNull(message="Target amount cannot be null") @Positive(message="Target amount cannot be less than or equal to zero") public @NotNull(message="Target amount cannot be null") @Positive(message="Target amount cannot be less than or equal to zero") BigDecimal target()Returns the value of thetargetrecord component.- Returns:
- the value of the
targetrecord component
-
completion
@NotNull(message="Completion amount cannot be null") @PositiveOrZero(message="Completion amount cannot be negative") public @NotNull(message="Completion amount cannot be null") @PositiveOrZero(message="Completion amount cannot be negative") BigDecimal completion()Returns the value of thecompletionrecord component.- Returns:
- the value of the
completionrecord component
-
description
@NotNull(message="Description cannot be null") @NotEmpty(message="Description cannot be empty") @NotBlank(message="Description cannot be blank") public @NotNull(message="Description cannot be null") @NotEmpty(message="Description cannot be empty") @NotBlank(message="Description cannot be blank") String description()Returns the value of thedescriptionrecord component.- Returns:
- the value of the
descriptionrecord component
-
priority
@NotNull(message="Priority cannot be null") @PositiveOrZero(message="Priority cannot be negative") public @NotNull(message="Priority cannot be null") @PositiveOrZero(message="Priority cannot be negative") Long priority()Returns the value of thepriorityrecord component.- Returns:
- the value of the
priorityrecord component
-
createdOn
@Past(message="Created date must be in the past") public @Past(message="Created date must be in the past") ZonedDateTime createdOn()Returns the value of thecreatedOnrecord component.- Returns:
- the value of the
createdOnrecord component
-
completedOn
@Future(message="Completed date must be in the future") public @Future(message="Completed date must be in the future") ZonedDateTime completedOn()Returns the value of thecompletedOnrecord component.- Returns:
- the value of the
completedOnrecord component
-
due
@Future(message="Due date must be in the future") public @Future(message="Due date must be in the future") ZonedDateTime due()Returns the value of theduerecord component.- Returns:
- the value of the
duerecord component
-