Skip to content

Commit f735cc2

Browse files
committed
HHH-16900 Restore API combatibiliy by using deprecated default methods
1 parent d3f4329 commit f735cc2

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

hibernate-core/src/main/java/org/hibernate/sql/model/MutationOperationGroup.java

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
*/
77
package org.hibernate.sql.model;
88

9+
import java.util.function.BiConsumer;
10+
import java.util.function.BiFunction;
11+
912
import org.hibernate.engine.jdbc.mutation.internal.EntityMutationOperationGroup;
1013

1114
/**
@@ -58,4 +61,28 @@ public interface MutationOperationGroup {
5861
default EntityMutationOperationGroup asEntityMutationOperationGroup() {
5962
return null;
6063
}
64+
65+
/**
66+
* @deprecated Will be removed. Use the other methods to visit each operation.
67+
*/
68+
@Deprecated(forRemoval = true)
69+
default <O extends MutationOperation> void forEachOperation(BiConsumer<Integer, O> action) {
70+
for ( int i = 0; i < getNumberOfOperations(); i++ ) {
71+
action.accept( i, (O) getOperation( i ) );
72+
}
73+
}
74+
75+
/**
76+
* @deprecated Will be removed. Use the other methods to visit each operation.
77+
*/
78+
@Deprecated(forRemoval = true)
79+
default <O extends MutationOperation> boolean hasMatching(BiFunction<Integer, O, Boolean> matcher) {
80+
for ( int i = 0; i < getNumberOfOperations(); i++ ) {
81+
if ( matcher.apply( i, (O) getOperation( i ) ) ) {
82+
return true;
83+
}
84+
}
85+
return false;
86+
}
87+
6188
}

0 commit comments

Comments
 (0)