Add PairValidator class for custom validation of even integers
This commit is contained in:
@@ -0,0 +1,12 @@
|
|||||||
|
package com.humanbooster.annotation;
|
||||||
|
|
||||||
|
import jakarta.validation.ConstraintValidator;
|
||||||
|
import jakarta.validation.ConstraintValidatorContext;
|
||||||
|
|
||||||
|
public class PairValidator implements ConstraintValidator<Pair, Integer> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isValid(Integer integer, ConstraintValidatorContext constraintValidatorContext) {
|
||||||
|
return (integer != null) && (integer % 2 == 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user