DATACMNS-520 - Fixed @Param validation in Parameters.
Parameters erroneously rejected @Param annotated query method parameters that were preceded by a non-bindable type (like Pageable or Sort) as it checked for a 0 index of the parameter. We now manually keep an index in the check itself and have removed the Parameter.isFirst() method as it's not used anywhere else.
This commit is contained in:
@@ -50,15 +50,6 @@ public class Parameter {
|
||||
this.parameter = parameter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the {@link Parameter} is the first one.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean isFirst() {
|
||||
return getIndex() == 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the parameter is a special parameter.
|
||||
*
|
||||
|
||||
@@ -258,15 +258,18 @@ public abstract class Parameters<S extends Parameters<S, T>, T extends Parameter
|
||||
private void assertEitherAllParamAnnotatedOrNone() {
|
||||
|
||||
boolean nameFound = false;
|
||||
int index = 0;
|
||||
|
||||
for (T parameter : this.getBindableParameters()) {
|
||||
|
||||
if (parameter.isNamedParameter()) {
|
||||
Assert.isTrue(nameFound || parameter.isFirst(), ALL_OR_NOTHING);
|
||||
Assert.isTrue(nameFound || index == 0, ALL_OR_NOTHING);
|
||||
nameFound = true;
|
||||
} else {
|
||||
Assert.isTrue(!nameFound, ALL_OR_NOTHING);
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user