validation - Java Constraint Annotations: Passing Parameter Value To Composite Constraint -


i'm trying create own composite validation annotation validate string - far made of annotations @notnull, @notblank , @size

however, not want leave these @ default values , want able pass in parameter value, example if @validstring (min = 1, max = 50), @size annotation can read these values - possible?

my constraint -

@notnull() @notblank() @size() @constraint(validatedby = validstringvalidator.class) @target({method, field, annotation_type, constructor, parameter}) @retention(runtime) public @interface validstring {     string message();     class<?>[] groups() default {};     class<? extends payload>[] payload() default {};     int min() default 1;     int max() default 255; } 

no, annotation can contain other annotations, e.g.

@notnull() @notblank() @constraint(validatedby = validstringvalidator.class) @target({method, field, annotation_type, constructor, parameter}) @retention(runtime) public @interface validstring {     string message();     class<?>[] groups() default {};     class<? extends payload>[] payload() default {};     size size() default @size(/*enter default size arguments here*/); 

}


Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -