BAEL-112 - custom validator - format fixes
This commit is contained in:
parent
f8bd663f7d
commit
42f1ef0bf3
@ -16,7 +16,9 @@ import javax.validation.Payload;
|
|||||||
public @interface ContactNumberConstraint {
|
public @interface ContactNumberConstraint {
|
||||||
|
|
||||||
String message() default "Invalid phone number";
|
String message() default "Invalid phone number";
|
||||||
|
|
||||||
Class<?>[] groups() default {};
|
Class<?>[] groups() default {};
|
||||||
|
|
||||||
Class<? extends Payload>[] payload() default {};
|
Class<? extends Payload>[] payload() default {};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,8 @@ import javax.validation.ConstraintValidatorContext;
|
|||||||
public class ContactNumberValidator implements ConstraintValidator<ContactNumberConstraint, String> {
|
public class ContactNumberValidator implements ConstraintValidator<ContactNumberConstraint, String> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initialize(ContactNumberConstraint contactNumber) {}
|
public void initialize(ContactNumberConstraint contactNumber) {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isValid(String contactField, ConstraintValidatorContext cxt) {
|
public boolean isValid(String contactField, ConstraintValidatorContext cxt) {
|
||||||
|
@ -15,4 +15,8 @@ public class ValidatedPhone {
|
|||||||
this.phone = phone;
|
this.phone = phone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return phone;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user