Record Class PatientDTO
java.lang.Object
java.lang.Record
com.mirna.hospitalmanagementapi.domain.dtos.patient.PatientDTO
public record PatientDTO(@NotBlank(message="name cannot be blank") String name, @NotBlank(message="email cannot be blank") @Email(message="invalid format for email") String email, @NotBlank(message="cpf cannot be blank") @Pattern(regexp="\\d{11}",message="invalid format for cpf") String cpf, @NotBlank(message="telephone cannot be blank") String telephone, @NotNull(message="address cannot be null") @Valid AddressDTO address)
extends Record
Data transfer object used to transfer data that will be saved in a Patient
entity
- Version:
- 1.0
- Author:
- Mirna Gama
-
Constructor Summary
ConstructorsConstructorDescriptionPatientDTO(@NotBlank(message="name cannot be blank") String name, @NotBlank(message="email cannot be blank") @Email(message="invalid format for email") String email, @NotBlank(message="cpf cannot be blank") @Pattern(regexp="\\d{11}",message="invalid format for cpf") String cpf, @NotBlank(message="telephone cannot be blank") String telephone, @NotNull(message="address cannot be null") @Valid AddressDTO address) Creates an instance of aPatientDTOrecord class. -
Method Summary
Modifier and TypeMethodDescription@NotNull(message="address cannot be null") @Valid AddressDTOaddress()Returns the value of theaddressrecord component.@NotBlank(message="cpf cannot be blank") @Pattern(regexp="\\d{11}",message="invalid format for cpf") Stringcpf()Returns the value of thecpfrecord component.@NotBlank(message="email cannot be blank") @Email(message="invalid format for email") Stringemail()Returns the value of theemailrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.@NotBlank(message="name cannot be blank") Stringname()Returns the value of thenamerecord component.@NotBlank(message="telephone cannot be blank") StringReturns the value of thetelephonerecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
PatientDTO
public PatientDTO(@NotBlank(message="name cannot be blank") @NotBlank(message="name cannot be blank") String name, @NotBlank(message="email cannot be blank") @Email(message="invalid format for email") @NotBlank(message="email cannot be blank") @Email(message="invalid format for email") String email, @NotBlank(message="cpf cannot be blank") @Pattern(regexp="\\d{11}",message="invalid format for cpf") @NotBlank(message="cpf cannot be blank") @Pattern(regexp="\\d{11}",message="invalid format for cpf") String cpf, @NotBlank(message="telephone cannot be blank") @NotBlank(message="telephone cannot be blank") String telephone, @NotNull(message="address cannot be null") @Valid @NotNull(message="address cannot be null") @Valid AddressDTO address) Creates an instance of aPatientDTOrecord class.- Parameters:
name- the value for thenamerecord componentemail- the value for theemailrecord componentcpf- the value for thecpfrecord componenttelephone- the value for thetelephonerecord componentaddress- the value for theaddressrecord 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). -
name
@NotBlank(message="name cannot be blank") public @NotBlank(message="name cannot be blank") String name()Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-
email
@NotBlank(message="email cannot be blank") @Email(message="invalid format for email") public @NotBlank(message="email cannot be blank") @Email(message="invalid format for email") String email()Returns the value of theemailrecord component.- Returns:
- the value of the
emailrecord component
-
cpf
@NotBlank(message="cpf cannot be blank") @Pattern(regexp="\\d{11}", message="invalid format for cpf") public @NotBlank(message="cpf cannot be blank") @Pattern(regexp="\\d{11}",message="invalid format for cpf") String cpf()Returns the value of thecpfrecord component.- Returns:
- the value of the
cpfrecord component
-
telephone
@NotBlank(message="telephone cannot be blank") public @NotBlank(message="telephone cannot be blank") String telephone()Returns the value of thetelephonerecord component.- Returns:
- the value of the
telephonerecord component
-
address
@NotNull(message="address cannot be null") @Valid public @NotNull(message="address cannot be null") @Valid AddressDTO address()Returns the value of theaddressrecord component.- Returns:
- the value of the
addressrecord component
-