Record Class ChallengeCreateDTO
java.lang.Object
java.lang.Record
org.ntnu.idi.idatt2106.sparesti.sparestibackend.dto.challenge.ChallengeCreateDTO
- Record Components:
title- Titlesaved- Saved amounttarget- Target amountperPurchase- Per unit pricedescription- Descriptiondue- Due datetype- Type
- All Implemented Interfaces:
Serializable
public record ChallengeCreateDTO(@NotBlank(message="Title cannot be blank") @Size(max=20,message="Title can max have 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, @NotNull(message="Per purchase amount cannot be null") @Positive(message="Per purchase amount cannot be less than or equal to zero") BigDecimal perPurchase, @Size(max=280,message="Description can at most have 280 characters") String description, @Future(message="Due date must be in the future") ZonedDateTime due, @Size(max=20,message="Type can have minimum 2 characters and max 20 characters") String type)
extends Record
implements Serializable
DTO for
Challenge- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionChallengeCreateDTO(@NotBlank(message="Title cannot be blank") @Size(max=20,message="Title can max have 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, @NotNull(message="Per purchase amount cannot be null") @Positive(message="Per purchase amount cannot be less than or equal to zero") BigDecimal perPurchase, @Size(max=280,message="Description can at most have 280 characters") String description, @Future(message="Due date must be in the future") ZonedDateTime due, @Size(max=20,message="Type can have minimum 2 characters and max 20 characters") String type) Creates an instance of aChallengeCreateDTOrecord class. -
Method Summary
Modifier and TypeMethodDescription@Size(max=280,message="Description can at most have 280 characters") 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="Per purchase amount cannot be null") @Positive(message="Per purchase amount cannot be less than or equal to zero") BigDecimalReturns the value of theperPurchaserecord 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.@NotBlank(message="Title cannot be blank") @Size(max=20,message="Title can max have 20 characters") Stringtitle()Returns the value of thetitlerecord component.final StringtoString()Returns a string representation of this record class.@Size(max=20,message="Type can have minimum 2 characters and max 20 characters") Stringtype()Returns the value of thetyperecord component.
-
Constructor Details
-
ChallengeCreateDTO
public ChallengeCreateDTO(@NotBlank(message="Title cannot be blank") @Size(max=20,message="Title can max have 20 characters") @NotBlank(message="Title cannot be blank") @Size(max=20,message="Title can max have 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, @NotNull(message="Per purchase amount cannot be null") @Positive(message="Per purchase amount cannot be less than or equal to zero") @NotNull(message="Per purchase amount cannot be null") @Positive(message="Per purchase amount cannot be less than or equal to zero") BigDecimal perPurchase, @Size(max=280,message="Description can at most have 280 characters") @Size(max=280,message="Description can at most have 280 characters") String description, @Future(message="Due date must be in the future") @Future(message="Due date must be in the future") ZonedDateTime due, @Size(max=20,message="Type can have minimum 2 characters and max 20 characters") @Size(max=20,message="Type can have minimum 2 characters and max 20 characters") String type) Creates an instance of aChallengeCreateDTOrecord class.- Parameters:
title- the value for thetitlerecord componentsaved- the value for thesavedrecord componenttarget- the value for thetargetrecord componentperPurchase- the value for theperPurchaserecord componentdescription- the value for thedescriptionrecord componentdue- the value for theduerecord componenttype- the value for thetyperecord 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 cannot be blank") @Size(max=20, message="Title can max have 20 characters") public @NotBlank(message="Title cannot be blank") @Size(max=20,message="Title can max have 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
-
perPurchase
@NotNull(message="Per purchase amount cannot be null") @Positive(message="Per purchase amount cannot be less than or equal to zero") public @NotNull(message="Per purchase amount cannot be null") @Positive(message="Per purchase amount cannot be less than or equal to zero") BigDecimal perPurchase()Returns the value of theperPurchaserecord component.- Returns:
- the value of the
perPurchaserecord component
-
description
@Size(max=280, message="Description can at most have 280 characters") public @Size(max=280,message="Description can at most have 280 characters") String description()Returns the value of thedescriptionrecord component.- Returns:
- the value of the
descriptionrecord 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
-
type
@Size(max=20, message="Type can have minimum 2 characters and max 20 characters") public @Size(max=20,message="Type can have minimum 2 characters and max 20 characters") String type()Returns the value of thetyperecord component.- Returns:
- the value of the
typerecord component
-