Skip to content

Commit

Permalink
code format
Browse files Browse the repository at this point in the history
  • Loading branch information
agrgr committed May 12, 2024
1 parent 9ceaba3 commit 42324fa
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,10 @@ private static boolean typeDoesNotRequireConversion(Object obj, FilterOperation

private static boolean isComparisonOperation(FilterOperation filterOperation) {
return switch (filterOperation) {
case EQ, NOTEQ, LT, LTEQ, GT, GTEQ, BETWEEN: yield true;
default: yield false;
case EQ, NOTEQ, LT, LTEQ, GT, GTEQ, BETWEEN:
yield true;
default:
yield false;
};
}

Expand Down Expand Up @@ -243,8 +245,7 @@ protected static void validateTypes(MappingAerospikeConverter converter, Class<?

private static boolean propertyTypeAndFirstParamAssignableToNumber(Class<?> propertyType,
List<Object> queryParameters) {
return queryParameters != null
&& queryParameters.size() > 0
return !queryParameters.isEmpty()
&& isAssignable(Number.class, propertyType)
&& isAssignableValue(Number.class, queryParameters.get(0));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,7 @@ private void validateCollectionQueryComparison(List<Object> queryParameters, Str
throw new IllegalArgumentException(queryPartDescription + ": invalid argument type, expecting Collection");
}

if (queryParameters.stream().anyMatch(param -> !(param instanceof List<?>))) {
throw new IllegalArgumentException(queryPartDescription + ": only Lists can be compared");
}
validateListType(queryParameters, queryPartDescription);
}

private void validateCollectionQueryBetween(List<Object> queryParameters, String queryPartDescription) {
Expand All @@ -117,6 +115,10 @@ private void validateCollectionQueryBetween(List<Object> queryParameters, String
"to be of the same class");
}

validateListType(queryParameters, queryPartDescription);
}

private void validateListType(List<Object> queryParameters, String queryPartDescription) {
if (queryParameters.stream().anyMatch(param -> !(param instanceof List<?>))) {
throw new IllegalArgumentException(queryPartDescription + ": only Lists can be compared");
}
Expand Down

0 comments on commit 42324fa

Please sign in to comment.