Skip to content

Commit

Permalink
Merge pull request #701 from mP1/feature/ExpressionFunctionParameter-…
Browse files Browse the repository at this point in the history
…checkCardinality

ExpressionFunctionParameter.checkCardinality
  • Loading branch information
mP1 authored Dec 6, 2023
2 parents 01f8d0f + 39f4f6b commit 4b0337d
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public static <T> ExpressionFunctionParameter<T> with(final ExpressionFunctionPa
checkName(name);
checkType(type);
checkTypeParameters(typeParameters);
Objects.requireNonNull(cardinality, "cardinality");
checkCardinality(cardinality);
Objects.requireNonNull(kinds, "kinds");

return new ExpressionFunctionParameter<>(
Expand All @@ -114,6 +114,10 @@ private static List<Class<?>> checkTypeParameters(final List<Class<?>> typeParam
return Objects.requireNonNull(typeParameters, "typeParameters");
}

private static ExpressionFunctionParameterCardinality checkCardinality(final ExpressionFunctionParameterCardinality cardinality) {
return Objects.requireNonNull(cardinality, "cardinality");
}

private ExpressionFunctionParameter(final ExpressionFunctionParameterName name,
final Class<T> type,
final ExpressionFunctionParameterCardinality cardinality,
Expand Down Expand Up @@ -210,7 +214,7 @@ public ExpressionFunctionParameterCardinality cardinality() {
* Would be setter that returns a {@link ExpressionFunctionParameter} with the given {@link ExpressionFunctionParameterCardinality}.
*/
public ExpressionFunctionParameter<T> setCardinality(final ExpressionFunctionParameterCardinality cardinality) {
Objects.requireNonNull(cardinality, "cardinality");
checkCardinality(cardinality);

return this.cardinality.equals(cardinality) ?
this :
Expand Down

0 comments on commit 4b0337d

Please sign in to comment.