Skip to content

Instantly share code, notes, and snippets.

@os890
Created June 22, 2018 18:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save os890/ac18bbc09dd9b2d2d22ec71310bb016a to your computer and use it in GitHub Desktop.
Save os890/ac18bbc09dd9b2d2d22ec71310bb016a to your computer and use it in GitHub Desktop.
@ReportAsSingleViolation
@Size
@Constraint(validatedBy = {})
@Target({FIELD, METHOD, PARAMETER})
@Retention(RUNTIME)
public @interface Length {
String message() default "{}"; //triggers the delegation to #messageId
Class<?>[] groups() default {};
Class<? extends Payload>[] payload() default {};
MyMessage messageId();
MyLabel propertyLabel();
@OverridesAttribute(constraint = Size.class, name = "min")
int min() default 0;
@OverridesAttribute(constraint = Size.class, name = "max")
int max() default Integer.MAX_VALUE;
//...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment