Skip to content

Commit

Permalink
[hotfix][table-common] ConstraintArgumentTypeStrategy uses Predicate …
Browse files Browse the repository at this point in the history
…rather than function
  • Loading branch information
slinkydeveloper authored and twalthr committed Apr 13, 2022
1 parent ffc3475 commit 8aebfb1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@

import java.util.Arrays;
import java.util.List;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.stream.Collectors;

/**
Expand Down Expand Up @@ -268,7 +268,7 @@ public static FamilyArgumentTypeStrategy logical(

/** Strategy for an argument that must fulfill a given constraint. */
public static ConstraintArgumentTypeStrategy constraint(
String constraintMessage, Function<List<DataType>, Boolean> evaluator) {
String constraintMessage, Predicate<List<DataType>> evaluator) {
return new ConstraintArgumentTypeStrategy(constraintMessage, evaluator);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,18 @@
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.Function;
import java.util.function.Predicate;

/** Strategy for an argument that must fulfill a given constraint. */
@Internal
public final class ConstraintArgumentTypeStrategy implements ArgumentTypeStrategy {

private final String constraintMessage;

private final Function<List<DataType>, Boolean> evaluator;
private final Predicate<List<DataType>> evaluator;

public ConstraintArgumentTypeStrategy(
String constraintMessage, Function<List<DataType>, Boolean> evaluator) {
String constraintMessage, Predicate<List<DataType>> evaluator) {
this.constraintMessage = constraintMessage;
this.evaluator = evaluator;
}
Expand All @@ -50,7 +50,7 @@ public Optional<DataType> inferArgumentType(
final List<DataType> actualDataTypes = callContext.getArgumentDataTypes();

// type fulfills constraint
if (evaluator.apply(actualDataTypes)) {
if (evaluator.test(actualDataTypes)) {
return Optional.of(actualDataTypes.get(argumentPos));
}

Expand Down

0 comments on commit 8aebfb1

Please sign in to comment.