Class SizeStringValidator
java.lang.Object
jp.ecuacion.lib.validation.constraints.SizeStringValidator
- All Implemented Interfaces:
jakarta.validation.ConstraintValidator<SizeString, String>
public class SizeStringValidator
extends Object
implements jakarta.validation.ConstraintValidator<SizeString, String>
Provides the validation logic for
SizeString.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidinitialize(SizeString constraintAnnotation) Initializes an instance.booleanChecks if a string is allowable size.
-
Constructor Details
-
SizeStringValidator
public SizeStringValidator()Constructs a new instance.
-
-
Method Details
-
initialize
Initializes an instance.- Specified by:
initializein interfacejakarta.validation.ConstraintValidator<SizeString, String>
-
isValid
Checks if a string is allowable size.a string is valid if the value is null or it's size is within min and max.
empty ("")is also valid.
Blank is allowed because it's supposed to be used for fields in record, which accepts values from external. HTML (and maybe others) cannot tell difference between blank and null for number values. Otherwise we also want the information whether the empty value is submitted (=blank) or not (=null).- Specified by:
isValidin interfacejakarta.validation.ConstraintValidator<SizeString, String>
-