Package com.priint.pubserver.validation
Class ValidationUtils
java.lang.Object
com.priint.pubserver.validation.ValidationUtils
Static methods useful for checking constraint violations with validation framework.
- Since:
- 4.0.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> booleanisValid(T entity) Checks the validity of the given object (entity) against the constraints set by annotation.static booleanisValidIdentifier(String input) Is input a valid pubserver identifier or not.static booleanisValidName(String input) Is input a valid pubserver name or not.static <T> voidvalidate(T entity) Checks the validity of the given object (entity) against the constraints set by annotation and throw an exception if anything is not valid.
-
Method Details
-
isValid
public static <T> boolean isValid(T entity) Checks the validity of the given object (entity) against the constraints set by annotation.In case of violation a log may be written - log level debug.
If you want to interpret the violation details it is recommended to build your own validator instance.
- Parameters:
entity-- Returns:
- true if valid
- See Also:
-
Validator.validate(Object, Class...)
-
validate
Checks the validity of the given object (entity) against the constraints set by annotation and throw an exception if anything is not valid.Exception message will contain information on the constraints that have been violated.
- Parameters:
entity-- Throws:
ValidationFailedException- See Also:
-
Validator.validate(Object, Class...)
-
isValidIdentifier
Is input a valid pubserver identifier or not. SeeValidIdentifier.
Null or empty string is considered invalid.- Parameters:
input- String to validate.
-
isValidName
Is input a valid pubserver name or not. SeeValidName.
Null or empty string is considered invalid.- Parameters:
input- String to validate.
-