HHH-16900 Avoid using the old method, ensure by removing the deprecated methods

This commit is contained in:
Sanne Grinovero 2023-07-04 20:42:02 +01:00 committed by Sanne Grinovero
parent 045f25511c
commit 441d280109
5 changed files with 10 additions and 95 deletions

View File

@ -6,10 +6,6 @@
*/
package org.hibernate.sql.model;
import java.util.List;
import java.util.function.BiConsumer;
import java.util.function.BiFunction;
/**
* Group of {@link MutationOperation} references for a specific
* logical operation (target + type)
@ -52,27 +48,4 @@ public interface MutationOperationGroup {
*/
MutationOperation getOperation(String tableName);
/**
* @deprecated Will be removed - use a combination of {@link #getNumberOfOperations()} and {@link #getOperation(int)}
* to iterate the list of operations.
*/
@Deprecated(forRemoval = true)
List<MutationOperation> getOperations();
/**
* Visit each operation
* @deprecated Will be removed - use a combination of {@link #getNumberOfOperations()} and {@link #getOperation(int)}
* to iterate the list of operations.
*/
@Deprecated(forRemoval = true)
void forEachOperation(BiConsumer<Integer, MutationOperation> action);
/**
* Test whether any operations match the condition
* @deprecated Will be removed - use a combination of {@link #getNumberOfOperations()} and {@link #getOperation(int)}
* to iterate the list of operations.
*/
@Deprecated(forRemoval = true)
boolean hasMatching(BiFunction<Integer, MutationOperation, Boolean> matcher);
}

View File

@ -9,7 +9,6 @@ package org.hibernate.sql.model.internal;
import java.util.Locale;
import java.util.function.BiConsumer;
import org.hibernate.sql.model.MutationOperation;
import org.hibernate.sql.model.MutationTarget;
import org.hibernate.sql.model.MutationType;
import org.hibernate.sql.model.ast.MutationGroup;
@ -46,17 +45,17 @@ public class MutationGroupNone implements MutationGroup {
}
@Override
public <O extends MutationOperation, M extends TableMutation<O>> M getSingleTableMutation() {
public TableMutation getSingleTableMutation() {
return null;
}
@Override
public <O extends MutationOperation, M extends TableMutation<O>> M getTableMutation(String tableName) {
public TableMutation getTableMutation(String tableName) {
return null;
}
@Override
public <O extends MutationOperation, M extends TableMutation<O>> void forEachTableMutation(BiConsumer<Integer, M> action) {
public void forEachTableMutation(BiConsumer<Integer, TableMutation> action) {
}
@Override

View File

@ -6,11 +6,6 @@
*/
package org.hibernate.sql.model.internal;
import java.util.Collections;
import java.util.List;
import java.util.function.BiConsumer;
import java.util.function.BiFunction;
import org.hibernate.sql.model.MutationOperation;
import org.hibernate.sql.model.MutationTarget;
import org.hibernate.sql.model.MutationType;
@ -44,23 +39,9 @@ public class MutationOperationGroupNone extends AbstractMutationOperationGroup {
throw new IndexOutOfBoundsException( idx );
}
@Override
public List<MutationOperation> getOperations() {
return Collections.emptyList();
}
@Override
public MutationOperation getOperation(String tableName) {
return null;
}
@Override
public void forEachOperation(BiConsumer<Integer, MutationOperation> action) {
}
@Override
public boolean hasMatching(BiFunction<Integer, MutationOperation, Boolean> matcher) {
return false;
}
}

View File

@ -6,11 +6,6 @@
*/
package org.hibernate.sql.model.internal;
import java.util.Collections;
import java.util.List;
import java.util.function.BiConsumer;
import java.util.function.BiFunction;
import org.hibernate.sql.model.MutationOperation;
import org.hibernate.sql.model.MutationTarget;
import org.hibernate.sql.model.MutationType;
@ -26,7 +21,10 @@ public class MutationOperationGroupSingle extends AbstractMutationOperationGroup
private final JdbcMutationOperation operation;
public MutationOperationGroupSingle(MutationType mutationType, MutationTarget<?> mutationTarget, JdbcMutationOperation operation) {
public MutationOperationGroupSingle(
MutationType mutationType,
MutationTarget<?> mutationTarget,
JdbcMutationOperation operation) {
super( mutationType, mutationTarget );
this.operation = operation;
}
@ -47,15 +45,12 @@ public class MutationOperationGroupSingle extends AbstractMutationOperationGroup
@Override
public MutationOperation getOperation(int idx) {
if ( idx != 0 ) throw new IndexOutOfBoundsException( idx );
if ( idx != 0 ) {
throw new IndexOutOfBoundsException( idx );
}
return operation;
}
@Override
public List<MutationOperation> getOperations() {
return Collections.singletonList( operation );
}
@Override
public MutationOperation getOperation(String tableName) {
if ( !tableName.equals( operation.getTableDetails().getTableName() ) ) {
@ -69,14 +64,4 @@ public class MutationOperationGroupSingle extends AbstractMutationOperationGroup
return operation;
}
@Override
public void forEachOperation(BiConsumer<Integer, MutationOperation> action) {
action.accept( 0, operation );
}
@Override
public boolean hasMatching(BiFunction<Integer, MutationOperation, Boolean> matcher) {
return matcher.apply( 0, operation );
}
}

View File

@ -8,8 +8,6 @@ package org.hibernate.sql.model.internal;
import java.util.List;
import java.util.Locale;
import java.util.function.BiConsumer;
import java.util.function.BiFunction;
import org.hibernate.sql.model.MutationOperation;
import org.hibernate.sql.model.MutationTarget;
@ -51,11 +49,6 @@ public class MutationOperationGroupStandard extends AbstractMutationOperationGro
return operations.get( idx );
}
@Override
public List<MutationOperation> getOperations() {
return operations;
}
@Override
public MutationOperation getOperation(String tableName) {
for ( int i = 0; i < operations.size(); i++ ) {
@ -67,20 +60,4 @@ public class MutationOperationGroupStandard extends AbstractMutationOperationGro
return null;
}
@Override
public void forEachOperation(BiConsumer<Integer, MutationOperation> action) {
for ( int i = 0; i < operations.size(); i++ ) {
action.accept( i, operations.get( i ) );
}
}
@Override
public boolean hasMatching(BiFunction<Integer, MutationOperation, Boolean> matcher) {
for ( int i = 0; i < operations.size(); i++ ) {
if ( matcher.apply( i, operations.get( i ) ) ) {
return true;
}
}
return false;
}
}