I have to validate the field when it is changed (both throw setter and reflection) in POJO. And I want to write an annotation to the field. The following code doesn't work:
public class PriceValidator implements ConstraintValidator<Price, BigDecimal> {
@Override
public void initialize(Price contactNumber) {
}
@Override
public boolean isValid(BigDecimal value, ConstraintValidatorContext cxt) {
if (smtng) {
{
//do smtng
}
}
return true;
}
}
How it can be realized this validator? How I should write the annotation correctly?
Aucun commentaire:
Enregistrer un commentaire