001package model.validation; 002 003import javax.validation.Constraint; 004import javax.validation.Payload; 005import java.lang.annotation.*; 006 007/** 008 * L'email deve essere univoca 009 * @see UniqueEmailValidator 010 */ 011@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER, 012 ElementType.ANNOTATION_TYPE}) 013@Retention(RetentionPolicy.RUNTIME) 014@Constraint(validatedBy = UniqueEmailValidator.class) 015@Documented 016public @interface UniqueEmail { 017 String message() default "Email already exists"; 018 019 Class<?>[] groups() default {}; 020 021 Class<? extends Payload>[] payload() default {}; 022}