Record Class GoalResponseDTO

java.lang.Object
java.lang.Record
org.ntnu.idi.idatt2106.sparesti.sparestibackend.dto.goal.GoalResponseDTO
Record Components:
id - Id of goal
title - Title of goal
saved - Saved amount
target - Target amount
completion - Completion percentage
description - Description
priority - Goal priority
createdOn - Created on date
completedOn - Completed on date
due - 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

    Constructors
    Constructor
    Description
    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)
    Creates an instance of a GoalResponseDTO record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    @Future(message="Completed date must be in the future") ZonedDateTime
    Returns the value of the completedOn record component.
    @NotNull(message="Completion amount cannot be null") @PositiveOrZero(message="Completion amount cannot be negative") BigDecimal
    Returns the value of the completion record component.
    @Past(message="Created date must be in the past") ZonedDateTime
    Returns the value of the createdOn record component.
    @NotNull(message="Description cannot be null") @NotEmpty(message="Description cannot be empty") @NotBlank(message="Description cannot be blank") String
    Returns the value of the description record component.
    @Future(message="Due date must be in the future") ZonedDateTime
    due()
    Returns the value of the due record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    @NotNull(message="ID cannot be null") Long
    id()
    Returns the value of the id record component.
    @NotNull(message="Priority cannot be null") @PositiveOrZero(message="Priority cannot be negative") Long
    Returns the value of the priority record component.
    @NotNull(message="Saved amount cannot be null") @PositiveOrZero(message="Saved amount cannot be negative") BigDecimal
    Returns the value of the saved record component.
    @NotNull(message="Target amount cannot be null") @Positive(message="Target amount cannot be less than or equal to zero") BigDecimal
    Returns the value of the target record component.
    @NotNull(message="Title cannot be null") @NotEmpty(message="Title cannot be empty") @NotBlank(message="Title cannot be blank") String
    Returns the value of the title record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • 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 a GoalResponseDTO record class.
      Parameters:
      id - the value for the id record component
      title - the value for the title record component
      saved - the value for the saved record component
      target - the value for the target record component
      completion - the value for the completion record component
      description - the value for the description record component
      priority - the value for the priority record component
      createdOn - the value for the createdOn record component
      completedOn - the value for the completedOn record component
      due - the value for the due 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.
    • id

      @NotNull(message="ID cannot be null") public @NotNull(message="ID cannot be null") Long id()
      Returns the value of the id record component.
      Returns:
      the value of the id record 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 the title record component.
      Returns:
      the value of the title record 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 the saved record component.
      Returns:
      the value of the saved record 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 the target record component.
      Returns:
      the value of the target record 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 the completion record component.
      Returns:
      the value of the completion record 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 the description record component.
      Returns:
      the value of the description record 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 the priority record component.
      Returns:
      the value of the priority record 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 the createdOn record component.
      Returns:
      the value of the createdOn record 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 the completedOn record component.
      Returns:
      the value of the completedOn record 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 the due record component.
      Returns:
      the value of the due record component