1

Is it possible for an attribute to group several javax validations on the same group without repeating the declaration ?

here is a valid example :

@Data
public class Poc {

    @NotNull(groups = {NameForm.class})
    private String name;

    @NotNull(groups = {DataForm.class})
    @Min(value = 0, groups = {DataForm.class})
    @Max(value = 10, groups = {DataForm.class})
    private int nbre = -1;

}

what I want to do is to find if it is possible to write something like this:

@Data
public class Poc {

    @NotNull(groups = {NameForm.class})
    private String name;

    @Groups(DataForm.class)
    @NotNull
    @Min(value = 0)
    @Max(value = 10)
    private int nbre = -1;

}
Mohamed Taboubi
  • 6,663
  • 11
  • 55
  • 87

0 Answers0