HHH-16900 Restore API combatibiliy by using deprecated default methods

This commit is contained in:
Sanne Grinovero 2023-07-05 17:32:44 +01:00 committed by Sanne Grinovero
parent 7d0da9e505
commit d0e3298e9d
1 changed files with 27 additions and 0 deletions

View File

@ -6,6 +6,9 @@
*/
package org.hibernate.sql.model;
import java.util.function.BiConsumer;
import java.util.function.BiFunction;
import org.hibernate.engine.jdbc.mutation.internal.EntityMutationOperationGroup;
/**
@ -58,4 +61,28 @@ public interface MutationOperationGroup {
default EntityMutationOperationGroup asEntityMutationOperationGroup() {
return null;
}
/**
* @deprecated Will be removed. Use the other methods to visit each operation.
*/
@Deprecated(forRemoval = true)
default <O extends MutationOperation> void forEachOperation(BiConsumer<Integer, O> action) {
for ( int i = 0; i < getNumberOfOperations(); i++ ) {
action.accept( i, (O) getOperation( i ) );
}
}
/**
* @deprecated Will be removed. Use the other methods to visit each operation.
*/
@Deprecated(forRemoval = true)
default <O extends MutationOperation> boolean hasMatching(BiFunction<Integer, O, Boolean> matcher) {
for ( int i = 0; i < getNumberOfOperations(); i++ ) {
if ( matcher.apply( i, (O) getOperation( i ) ) ) {
return true;
}
}
return false;
}
}