diff --git a/hibernate-core/src/main/java/org/hibernate/sql/model/MutationOperationGroup.java b/hibernate-core/src/main/java/org/hibernate/sql/model/MutationOperationGroup.java index 68cdb94c45..215d850f32 100644 --- a/hibernate-core/src/main/java/org/hibernate/sql/model/MutationOperationGroup.java +++ b/hibernate-core/src/main/java/org/hibernate/sql/model/MutationOperationGroup.java @@ -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 void forEachOperation(BiConsumer 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 boolean hasMatching(BiFunction matcher) { + for ( int i = 0; i < getNumberOfOperations(); i++ ) { + if ( matcher.apply( i, (O) getOperation( i ) ) ) { + return true; + } + } + return false; + } + }