Record Class UserRequest
java.lang.Object
java.lang.Record
com.example.security.user.dto.UserRequest
- Record Components:
name- nombre visibleemail- correo de la cuentapassword- contraseña obligatoria en el alta y opcional en la ediciónrole- rol asignado a la cuentaenabled- indica si la cuenta está habilitada
public record UserRequest(@NotBlank @Size(min=2,max=80) String name, @NotBlank @Email @Size(max=160) String email, @Pattern(regexp="^$|[\\s\\S]{8,72}",message="debe tener entre 8 y 72 caracteres, o estar vac\u00eda") String password, @NotNull Role role, @NotNull Boolean enabled)
extends Record
Datos de alta o edición administrativa de una cuenta.
-
Constructor Summary
ConstructorsConstructorDescriptionUserRequest(@NotBlank @Size(min=2,max=80) String name, @NotBlank @Email @Size(max=160) String email, @Pattern(regexp="^$|[\\s\\S]{8,72}",message="debe tener entre 8 y 72 caracteres, o estar vac\u00eda") String password, @NotNull Role role, @NotNull Boolean enabled) Creates an instance of aUserRequestrecord class. -
Method Summary
Modifier and TypeMethodDescription@NotBlank @Email @Size(max=160) Stringemail()Returns the value of theemailrecord component.@NotNull Booleanenabled()Returns the value of theenabledrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.@AssertTrue(message="La contrase\u00f1a no puede superar 72 bytes UTF-8.") booleanComprueba el límite de BCrypt sobre los bytes UTF-8.@NotBlank @Size(min=2,max=80) Stringname()Returns the value of thenamerecord component.@Pattern(regexp="^$|[\\s\\S]{8,72}",message="debe tener entre 8 y 72 caracteres, o estar vac\u00eda") Stringpassword()Returns the value of thepasswordrecord component.@NotNull Rolerole()Returns the value of therolerecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
UserRequest
public UserRequest(@NotBlank @Size(min=2,max=80) @NotBlank @Size(min=2,max=80) String name, @NotBlank @Email @Size(max=160) @NotBlank @Email @Size(max=160) String email, @Pattern(regexp="^$|[\\s\\S]{8,72}",message="debe tener entre 8 y 72 caracteres, o estar vac\u00eda") @Pattern(regexp="^$|[\\s\\S]{8,72}",message="debe tener entre 8 y 72 caracteres, o estar vac\u00eda") String password, @NotNull @NotNull Role role, @NotNull @NotNull Boolean enabled) Creates an instance of aUserRequestrecord class.
-
-
Method Details
-
isPasswordWithinBcryptLimit
@AssertTrue(message="La contrase\u00f1a no puede superar 72 bytes UTF-8.") public @AssertTrue(message="La contrase\u00f1a no puede superar 72 bytes UTF-8.") boolean isPasswordWithinBcryptLimit()Comprueba el límite de BCrypt sobre los bytes UTF-8. Un carácter puede ocupar varios bytes.- Returns:
- si la contraseña está ausente o tiene como máximo 72 bytes
-
toString
-
hashCode
-
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
-
email
-
password
@Pattern(regexp="^$|[\\s\\S]{8,72}", message="debe tener entre 8 y 72 caracteres, o estar vac\u00eda") public @Pattern(regexp="^$|[\\s\\S]{8,72}",message="debe tener entre 8 y 72 caracteres, o estar vac\u00eda") String password()Returns the value of thepasswordrecord component.- Returns:
- the value of the
passwordrecord component
-
role
-
enabled
-