@Handler(supports=User.class, order=50) public class UserValidator extends Object implements org.springframework.validation.Validator
Constructor and Description |
---|
UserValidator() |
Modifier and Type | Method and Description |
---|---|
boolean |
isUserNameAsEmailValid(String username)
Returns true if the given username is a valid e-mail.
|
boolean |
isUserNameValid(String username)
Convenience method to check the given username against the regular expression.
|
boolean |
supports(Class<?> clazz)
Determines if the command object being submitted is a valid type
|
void |
validate(Object obj,
org.springframework.validation.Errors errors)
Checks the form object for any inconsistencies/errors
|
public boolean supports(Class<?> clazz)
supports
in interface org.springframework.validation.Validator
Validator.supports(java.lang.Class)
public void validate(Object obj, org.springframework.validation.Errors errors)
validate
in interface org.springframework.validation.Validator
Should fail validation if retired and retireReason is null
Should fail validation if retired and retireReason is empty
Should fail validation if retired and retireReason is whitespace
Should pass validation if all required fields have proper values
Should fail validation if email as username enabled and email invalid
Should fail validation if email as username disabled and email provided
Should not throw NPE when user is null
Should pass validation if field lengths are correct
Should fail validation if field lengths are not correct
public boolean isUserNameValid(String username)
username
- the username string to checkpublic boolean isUserNameAsEmailValid(String username)
username
- Copyright © 2024 OpenMRS Inc.. All rights reserved.