From d0e3298e9dfcc061fed75475f6d446cbd98a9b02 Mon Sep 17 00:00:00 2001 From: Sanne Grinovero Date: Wed, 5 Jul 2023 17:32:44 +0100 Subject: [PATCH] HHH-16900 Restore API combatibiliy by using deprecated default methods --- .../sql/model/MutationOperationGroup.java | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) 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; + } + }