Record Class GoalUpdateDTO

java.lang.Object
java.lang.Record
org.ntnu.idi.idatt2106.sparesti.sparestibackend.dto.goal.GoalUpdateDTO
Record Components:
title - Title of goal
saved - Saved amount
target - Target amount
description - Description
due - Due date
All Implemented Interfaces:
Serializable

public record GoalUpdateDTO(@NotBlank(message="Title cannot be blank") @Size(max=20,message="Title can max be 20 characters") String title, @PositiveOrZero(message="Saved amount cannot be negative") BigDecimal saved, @Positive(message="Target amount cannot be less than or equal to zero") BigDecimal target, @Size(max=280,message="Description can max be 280 characters") String description, @Future(message="Due date cannot be in the past or now") ZonedDateTime due) extends Record implements Serializable
DTO for Goal
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    GoalUpdateDTO(@NotBlank(message="Title cannot be blank") @Size(max=20,message="Title can max be 20 characters") String title, @PositiveOrZero(message="Saved amount cannot be negative") BigDecimal saved, @Positive(message="Target amount cannot be less than or equal to zero") BigDecimal target, @Size(max=280,message="Description can max be 280 characters") String description, @Future(message="Due date cannot be in the past or now") ZonedDateTime due)
    Creates an instance of a GoalUpdateDTO record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    @Size(max=280,message="Description can max be 280 characters") String
    Returns the value of the description record component.
    @Future(message="Due date cannot be in the past or now") 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.
    @PositiveOrZero(message="Saved amount cannot be negative") BigDecimal
    Returns the value of the saved record component.
    @Positive(message="Target amount cannot be less than or equal to zero") BigDecimal
    Returns the value of the target record component.
    @NotBlank(message="Title cannot be blank") @Size(max=20,message="Title can max be 20 characters") 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

    • GoalUpdateDTO

      public GoalUpdateDTO(@NotBlank(message="Title cannot be blank") @Size(max=20,message="Title can max be 20 characters") @NotBlank(message="Title cannot be blank") @Size(max=20,message="Title can max be 20 characters") String title, @PositiveOrZero(message="Saved amount cannot be negative") @PositiveOrZero(message="Saved amount cannot be negative") BigDecimal saved, @Positive(message="Target amount cannot be less than or equal to zero") @Positive(message="Target amount cannot be less than or equal to zero") BigDecimal target, @Size(max=280,message="Description can max be 280 characters") @Size(max=280,message="Description can max be 280 characters") String description, @Future(message="Due date cannot be in the past or now") @Future(message="Due date cannot be in the past or now") ZonedDateTime due)
      Creates an instance of a GoalUpdateDTO record class.
      Parameters:
      title - the value for the title record component
      saved - the value for the saved record component
      target - the value for the target record component
      description - the value for the description 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.
    • title

      @NotBlank(message="Title cannot be blank") @Size(max=20, message="Title can max be 20 characters") public @NotBlank(message="Title cannot be blank") @Size(max=20,message="Title can max be 20 characters") String title()
      Returns the value of the title record component.
      Returns:
      the value of the title record component
    • saved

      @PositiveOrZero(message="Saved amount cannot be negative") public @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

      @Positive(message="Target amount cannot be less than or equal to zero") public @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
    • description

      @Size(max=280, message="Description can max be 280 characters") public @Size(max=280,message="Description can max be 280 characters") String description()
      Returns the value of the description record component.
      Returns:
      the value of the description record component
    • due

      @Future(message="Due date cannot be in the past or now") public @Future(message="Due date cannot be in the past or now") ZonedDateTime due()
      Returns the value of the due record component.
      Returns:
      the value of the due record component