Class IntegerStringValidator
java.lang.Object
jp.ecuacion.lib.core.jakartavalidation.validator.IntegerStringValidator
- All Implemented Interfaces:
jakarta.validation.ConstraintValidator<IntegerString, String>
public class IntegerStringValidator
extends Object
implements jakarta.validation.ConstraintValidator<IntegerString, String>
Provides the validation logic for
IntegerString.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidinitialize(IntegerString constraintAnnotation) Initializes an instance.booleanChecks if a string is convertable toInteger.
-
Constructor Details
-
IntegerStringValidator
public IntegerStringValidator()Constructs a new instance.
-
-
Method Details
-
initialize
Initializes an instance.- Specified by:
initializein interfacejakarta.validation.ConstraintValidator<IntegerString, String>
-
isValid
Checks if a string is convertable toInteger.a string is valid if
Integer.valueOf()does not throw exception.comma-separated value is acceptable. This validator removes comma before check. This does not check the positions of the commas are correct.
Valid strings are: "
123", "123,456", "12,3,4,56"nullis valid following to the specification of Jakarta EE.
empty ("")is invalid.- Specified by:
isValidin interfacejakarta.validation.ConstraintValidator<IntegerString, String>
-