Record Class AddressRequestDTO
java.lang.Object
java.lang.Record
com.fiap.tech_challenge.parte1.ms_users.dtos.AddressRequestDTO
- Record Components:
zipcode
- the postal code of the address (required, non-blank)street
- the street name of the address (required, non-blank)number
- the street number (required, not null)complement
- an optional additional address detailneighborhood
- the neighborhood name (required, non-blank)city
- the city name (required, non-blank)state
- the two-letter state code (required, exactly 2 characters)
public record AddressRequestDTO(@NotBlank(message="Address field \'zipcode\' is required") String zipcode, @NotBlank(message="Address field \'street\' is required") String street, @NotNull(message="Address field \'number\' is required") Integer number, String complement, @NotBlank(message="Address field \'neighborhood\' is required") String neighborhood, @NotBlank(message="Address field \'city\' is required") String city, @NotBlank(message="Address field \'state\' is required") @Size(min=2,max=2,message="Address field \'state\' must be a 2-letter code") String state)
extends Record
Data Transfer Object for address requests.
This DTO is used to transfer address data from client to server
when creating or updating a user's address.
Validation constraints ensure required fields are present and valid.
-
Constructor Summary
ConstructorsConstructorDescriptionAddressRequestDTO
(@NotBlank(message="Address field \'zipcode\' is required") String zipcode, @NotBlank(message="Address field \'street\' is required") String street, @NotNull(message="Address field \'number\' is required") Integer number, String complement, @NotBlank(message="Address field \'neighborhood\' is required") String neighborhood, @NotBlank(message="Address field \'city\' is required") String city, @NotBlank(message="Address field \'state\' is required") @Size(min=2,max=2,message="Address field \'state\' must be a 2-letter code") String state) Creates an instance of aAddressRequestDTO
record class. -
Method Summary
Modifier and TypeMethodDescription@NotBlank(message="Address field \'city\' is required") String
city()
Returns the value of thecity
record component.Returns the value of thecomplement
record component.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.@NotBlank(message="Address field \'neighborhood\' is required") String
Returns the value of theneighborhood
record component.@NotNull(message="Address field \'number\' is required") Integer
number()
Returns the value of thenumber
record component.@NotBlank(message="Address field \'state\' is required") @Size(min=2,max=2,message="Address field \'state\' must be a 2-letter code") String
state()
Returns the value of thestate
record component.@NotBlank(message="Address field \'street\' is required") String
street()
Returns the value of thestreet
record component.final String
toString()
Returns a string representation of this record class.@NotBlank(message="Address field \'zipcode\' is required") String
zipcode()
Returns the value of thezipcode
record component.
-
Constructor Details
-
AddressRequestDTO
public AddressRequestDTO(@NotBlank(message="Address field \'zipcode\' is required") @NotBlank(message="Address field \'zipcode\' is required") String zipcode, @NotBlank(message="Address field \'street\' is required") @NotBlank(message="Address field \'street\' is required") String street, @NotNull(message="Address field \'number\' is required") @NotNull(message="Address field \'number\' is required") Integer number, String complement, @NotBlank(message="Address field \'neighborhood\' is required") @NotBlank(message="Address field \'neighborhood\' is required") String neighborhood, @NotBlank(message="Address field \'city\' is required") @NotBlank(message="Address field \'city\' is required") String city, @NotBlank(message="Address field \'state\' is required") @Size(min=2,max=2,message="Address field \'state\' must be a 2-letter code") @NotBlank(message="Address field \'state\' is required") @Size(min=2,max=2,message="Address field \'state\' must be a 2-letter code") String state) Creates an instance of aAddressRequestDTO
record class.- Parameters:
zipcode
- the value for thezipcode
record componentstreet
- the value for thestreet
record componentnumber
- the value for thenumber
record componentcomplement
- the value for thecomplement
record componentneighborhood
- the value for theneighborhood
record componentcity
- the value for thecity
record componentstate
- the value for thestate
record 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)
. -
zipcode
@NotBlank(message="Address field \'zipcode\' is required") public @NotBlank(message="Address field \'zipcode\' is required") String zipcode()Returns the value of thezipcode
record component.- Returns:
- the value of the
zipcode
record component
-
street
@NotBlank(message="Address field \'street\' is required") public @NotBlank(message="Address field \'street\' is required") String street()Returns the value of thestreet
record component.- Returns:
- the value of the
street
record component
-
number
@NotNull(message="Address field \'number\' is required") public @NotNull(message="Address field \'number\' is required") Integer number()Returns the value of thenumber
record component.- Returns:
- the value of the
number
record component
-
complement
Returns the value of thecomplement
record component.- Returns:
- the value of the
complement
record component
-
neighborhood
@NotBlank(message="Address field \'neighborhood\' is required") public @NotBlank(message="Address field \'neighborhood\' is required") String neighborhood()Returns the value of theneighborhood
record component.- Returns:
- the value of the
neighborhood
record component
-
city
@NotBlank(message="Address field \'city\' is required") public @NotBlank(message="Address field \'city\' is required") String city()Returns the value of thecity
record component.- Returns:
- the value of the
city
record component
-
state
@NotBlank(message="Address field \'state\' is required") @Size(min=2, max=2, message="Address field \'state\' must be a 2-letter code") public @NotBlank(message="Address field \'state\' is required") @Size(min=2,max=2,message="Address field \'state\' must be a 2-letter code") String state()Returns the value of thestate
record component.- Returns:
- the value of the
state
record component
-