001package model.validation; 002 003import javax.validation.Constraint; 004import javax.validation.Payload; 005import javax.validation.constraints.Email; 006import javax.validation.constraints.Size; 007import java.lang.annotation.*; 008 009/** 010 * L'email deve avere un formato valido 011 */ 012@Size(max=255) 013@Email(regexp = "^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|\"(?:[\\x01-\\x08\\x0b\\" + 014 "x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[a-z0-9" + 015 "](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9" + 016 "]|[1-9]?[0-9]))\\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\\x01-" + 017 "\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\])$") //lol 018@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER, 019 ElementType.ANNOTATION_TYPE}) 020@Retention(RetentionPolicy.RUNTIME) 021@Constraint(validatedBy = {}) 022@Documented 023public @interface EmailFormat { 024 String message() default "Formato email non valido"; 025 026 Class<?>[] groups() default {}; 027 028 Class<? extends Payload>[] payload() default {}; 029}