Record Class RegisterForm
java.lang.Object
java.lang.Record
com.ericbouchut.learndev.auth.dto.RegisterForm
- Record Components:
username- chosen username (3 to 50 characters)email- email address (valid format, up to 255 characters)password- raw password (8 to 100 characters) (MUST be hashed before storage)
public record RegisterForm(@NotBlank @Size(min=3,max=50) String username, @NotBlank @Email @Size(max=255) String email, @NotBlank @Size(min=8,max=100) String password)
extends Record
RegisterForm holds the data submitted by a browser HTML form for user registration.
It is validated with Bean Validation.
The constraints are enforced when a controller binds it with @Valid,
so invalid input is rejected before it reaches the service.
It is an inbound Data Transfer Object (DTO): Web Browser => Controller.-
Constructor Summary
ConstructorsConstructorDescriptionRegisterForm(@NotBlank @Size(min=3,max=50) String username, @NotBlank @Email @Size(max=255) String email, @NotBlank @Size(min=8,max=100) String password) Creates an instance of aRegisterFormrecord class. -
Method Summary
Modifier and TypeMethodDescription@NotBlank @Email @Size(max=255) 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 @Size(min=8,max=100) Stringpassword()Returns the value of thepasswordrecord component.final StringtoString()Returns a string representation of this record class.@NotBlank @Size(min=3,max=50) Stringusername()Returns the value of theusernamerecord component.
-
Constructor Details
-
RegisterForm
public RegisterForm(@NotBlank @Size(min=3,max=50) @NotBlank @Size(min=3,max=50) String username, @NotBlank @Email @Size(max=255) @NotBlank @Email @Size(max=255) String email, @NotBlank @Size(min=8,max=100) @NotBlank @Size(min=8,max=100) String password) Creates an instance of aRegisterFormrecord class.
-
-
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). -
username
Returns the value of theusernamerecord component.- Returns:
- the value of the
usernamerecord component
-
email
Returns the value of theemailrecord component.- Returns:
- the value of the
emailrecord component
-
password
Returns the value of thepasswordrecord component.- Returns:
- the value of the
passwordrecord component
-