Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.homework.annotations;
- import java.lang.annotation.Documented;
- import java.lang.annotation.ElementType;
- import java.lang.annotation.Retention;
- import java.lang.annotation.RetentionPolicy;
- import java.lang.annotation.Target;
- import javax.validation.Constraint;
- import javax.validation.Payload;
- import javax.validation.constraints.Pattern;
- @Pattern.List({ @Pattern(regexp = "^(?=.*\\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[^a-zA-Z0-9])(?!.*\\s).{4,30}$",message = "Invalid Password") })
- @Constraint(validatedBy = {})
- @Documented
- @Target({ ElementType.METHOD, ElementType.FIELD, ElementType.ANNOTATION_TYPE,
- ElementType.CONSTRUCTOR, ElementType.PARAMETER })
- @Retention(RetentionPolicy.RUNTIME)
- public @interface Password {
- String message() default "{invalid.password}";
- Class<?>[] groups() default {};
- Class<? extends Payload>[] payload() default {};
- @Target({ElementType.METHOD,
- ElementType.FIELD,
- ElementType.ANNOTATION_TYPE,
- ElementType.CONSTRUCTOR,
- ElementType.PARAMETER})
- @Retention(RetentionPolicy.RUNTIME)
- @Documented
- @interface List {
- Password[] value();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment