Skip to content
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ public Optional<ExecutableMetaData> getMetaDataFor(Executable executable) {
@Override
public List<Class<?>> getDefaultGroupSequence(T beanState) {
if ( hasDefaultGroupSequenceProvider() ) {
List<Class<?>> providerDefaultGroupSequence = defaultGroupSequenceProvider.getValidationGroups( beanState );
List<Class<?>> providerDefaultGroupSequence = defaultGroupSequenceProvider.getValidationGroups( beanClass, beanState );
return getValidDefaultGroupSequence( beanClass, providerDefaultGroupSequence );
}

Expand All @@ -335,7 +335,7 @@ public List<Class<?>> getDefaultGroupSequence(T beanState) {
@Override
public Iterator<Sequence> getDefaultValidationSequence(T beanState) {
if ( hasDefaultGroupSequenceProvider() ) {
List<Class<?>> providerDefaultGroupSequence = defaultGroupSequenceProvider.getValidationGroups( beanState );
List<Class<?>> providerDefaultGroupSequence = defaultGroupSequenceProvider.getValidationGroups( beanClass, beanState );
return validationOrderGenerator.getDefaultValidationOrder(
beanClass,
getValidDefaultGroupSequence( beanClass, providerDefaultGroupSequence )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,23 @@
*/
public interface DefaultGroupSequenceProvider<T> {

/**
* This method returns the default group sequence for the given instance.
* <p>
* The object parameter allows to dynamically compose the default group sequence in function of the validated value state.
* </p>
*
* @param clazz the instance class being validated.
* @param object the instance being validated. This value can be {@code null} in case this method was called as part of
* {@linkplain jakarta.validation.Validator#validateValue(Class, String, Object, Class[]) Validator#validateValue}.
*
* @return a list of classes specifying the default group sequence. The same constraints to the redefined group list
* apply as for lists defined via {@code GroupSequence}. In particular the list has to contain the type T.
*/
default List<Class<?>> getValidationGroups(Class<?> clazz, T object) {
return getValidationGroups( object );
}

/**
* This method returns the default group sequence for the given instance.
* <p>
Expand Down