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