Record Class DoctorDTO
java.lang.Object
java.lang.Record
com.mirna.hospitalmanagementapi.domain.dtos.DoctorDTO
public record DoctorDTO(@NotBlank(message="name cannot be blank") String name, @NotBlank(message="email cannot be blank") @Email(message="invalid format for email") String email, @NotBlank(message="crm cannot be blank") @Pattern(regexp="\\d{4,6}",message="invalid format for crm") String crm, @NotBlank(message="telephone cannot be blank") String telephone, @NotNull(message="speciality cannot be null") @Valid Specialty specialty, @NotNull(message="address cannot be null") @Valid AddressDTO address)
extends Record
Data transfer object used to transfer data that will be saved in a Doctor entity
- Version:
- 1.0
- Author:
- Mirna Gama
-
Constructor Summary
ConstructorsConstructorDescriptionDoctorDTO(@NotBlank(message="name cannot be blank") String name, @NotBlank(message="email cannot be blank") @Email(message="invalid format for email") String email, @NotBlank(message="crm cannot be blank") @Pattern(regexp="\\d{4,6}",message="invalid format for crm") String crm, @NotBlank(message="telephone cannot be blank") String telephone, @NotNull(message="speciality cannot be null") @Valid Specialty specialty, @NotNull(message="address cannot be null") @Valid AddressDTO address) Creates an instance of aDoctorDTOrecord class. -
Method Summary
Modifier and TypeMethodDescription@NotNull(message="address cannot be null") @Valid AddressDTOaddress()Returns the value of theaddressrecord component.@NotBlank(message="crm cannot be blank") @Pattern(regexp="\\d{4,6}",message="invalid format for crm") Stringcrm()Returns the value of thecrmrecord 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.@NotNull(message="speciality cannot be null") @Valid SpecialtyReturns the value of thespecialtyrecord 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
-
DoctorDTO
public DoctorDTO(@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="crm cannot be blank") @Pattern(regexp="\\d{4,6}",message="invalid format for crm") @NotBlank(message="crm cannot be blank") @Pattern(regexp="\\d{4,6}",message="invalid format for crm") String crm, @NotBlank(message="telephone cannot be blank") @NotBlank(message="telephone cannot be blank") String telephone, @NotNull(message="speciality cannot be null") @Valid @NotNull(message="speciality cannot be null") @Valid Specialty specialty, @NotNull(message="address cannot be null") @Valid @NotNull(message="address cannot be null") @Valid AddressDTO address) Creates an instance of aDoctorDTOrecord class.- Parameters:
name- the value for thenamerecord componentemail- the value for theemailrecord componentcrm- the value for thecrmrecord componenttelephone- the value for thetelephonerecord componentspecialty- the value for thespecialtyrecord 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
-
crm
@NotBlank(message="crm cannot be blank") @Pattern(regexp="\\d{4,6}", message="invalid format for crm") public @NotBlank(message="crm cannot be blank") @Pattern(regexp="\\d{4,6}",message="invalid format for crm") String crm()Returns the value of thecrmrecord component.- Returns:
- the value of the
crmrecord 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
-
specialty
@NotNull(message="speciality cannot be null") @Valid public @NotNull(message="speciality cannot be null") @Valid Specialty specialty()Returns the value of thespecialtyrecord component.- Returns:
- the value of the
specialtyrecord 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
-