I want to make annotations that are already 'grouped' to increase readability (decrease visual noise). The name of the Constraint Annotation is already extremely clear for when the validation will occur.
Specifically:
Code:
@RequiredForCreateAttribute
@UpdatableAttribute(false)
public String getKey() {
return key;
}
is easier to use and read for me than this:
Code:
@NotNull(groups = CreateValidation.class)
@Null(groups = UpdateValidation.class)
public String getKey() {
return key;
}
Where RequiredForCreateAttribute and UpdatableAttribute are Constraints that have attributes like:
Code:
Class<?>[] groups() default { CreateValidation.class };
or
Code:
Class<?>[] groups() default { UpdateValidation.class };
Is it possible to consider allowing this in a future version, or is there a great reason why groups must default to an empty list?