Record Class GoalCreateDTO
java.lang.Object
java.lang.Record
org.ntnu.idi.idatt2106.sparesti.sparestibackend.dto.goal.GoalCreateDTO
- Record Components:
title- Title of goalsaved- Saved amounttarget- Target amountdescription- Descriptiondue- Due date
- All Implemented Interfaces:
Serializable
public record GoalCreateDTO(@NotEmpty(message="Title cannot be empty") @NotBlank(message="Title cannot be blank") @Size(max=20,message="Title can max be 20 characters") 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, @Size(max=280,message="Description can max be 280 characters") String description, @NotNull(message="Due date cannot be null") @Future(message="Due date cannot be in the past or now") ZonedDateTime due)
extends Record
implements Serializable
DTO for
Goal- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionGoalCreateDTO(@NotEmpty(message="Title cannot be empty") @NotBlank(message="Title cannot be blank") @Size(max=20,message="Title can max be 20 characters") 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, @Size(max=280,message="Description can max be 280 characters") String description, @NotNull(message="Due date cannot be null") @Future(message="Due date cannot be in the past or now") ZonedDateTime due) Creates an instance of aGoalCreateDTOrecord class. -
Method Summary
Modifier and TypeMethodDescription@Size(max=280,message="Description can max be 280 characters") StringReturns the value of thedescriptionrecord component.@NotNull(message="Due date cannot be null") @Future(message="Due date cannot be in the past or now") 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="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.@NotEmpty(message="Title cannot be empty") @NotBlank(message="Title cannot be blank") @Size(max=20,message="Title can max be 20 characters") Stringtitle()Returns the value of thetitlerecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
GoalCreateDTO
public GoalCreateDTO(@NotEmpty(message="Title cannot be empty") @NotBlank(message="Title cannot be blank") @Size(max=20,message="Title can max be 20 characters") @NotEmpty(message="Title cannot be empty") @NotBlank(message="Title cannot be blank") @Size(max=20,message="Title can max be 20 characters") 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, @Size(max=280,message="Description can max be 280 characters") @Size(max=280,message="Description can max be 280 characters") String description, @NotNull(message="Due date cannot be null") @Future(message="Due date cannot be in the past or now") @NotNull(message="Due date cannot be null") @Future(message="Due date cannot be in the past or now") ZonedDateTime due) Creates an instance of aGoalCreateDTOrecord class.- Parameters:
title- the value for thetitlerecord componentsaved- the value for thesavedrecord componenttarget- the value for thetargetrecord componentdescription- the value for thedescriptionrecord 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). -
title
@NotEmpty(message="Title cannot be empty") @NotBlank(message="Title cannot be blank") @Size(max=20, message="Title can max be 20 characters") public @NotEmpty(message="Title cannot be empty") @NotBlank(message="Title cannot be blank") @Size(max=20,message="Title can max be 20 characters") 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
-
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 thedescriptionrecord component.- Returns:
- the value of the
descriptionrecord component
-
due
@NotNull(message="Due date cannot be null") @Future(message="Due date cannot be in the past or now") public @NotNull(message="Due date cannot be null") @Future(message="Due date cannot be in the past or now") ZonedDateTime due()Returns the value of theduerecord component.- Returns:
- the value of the
duerecord component
-