Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ExpressionFunctionParameter.checkCardinality #701

Merged
merged 1 commit into from
Dec 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading