package com.captechconsulting.facade.v1_0.validators; import javax.validation.constraints.Pattern; import java.lang.annotation.Documented; import java.lang.annotation.Retention; import java.lang.annotation.Target; import static java.lang.annotation.ElementType.ANNOTATION_TYPE; import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.RetentionPolicy.RUNTIME; @Target( { METHOD, FIELD, ANNOTATION_TYPE }) @Retention(RUNTIME) @Documented @Pattern(regexp = "^\\(?([0-9]{3})\\)?([ .-]?)([0-9]{3})\\2([0-9]{4})$", message = "{error.validation.phonenumber}") public @interface PhoneNumber { }