-
Notifications
You must be signed in to change notification settings - Fork 29
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
FMWK-252 Refactor query creator #647
Conversation
private Qualifier processId(Object value1) { | ||
Qualifier qualifier; | ||
if (value1 instanceof Collection<?>) { | ||
qualifier = forIds(((Collection<?>) value1).toArray(String[]::new)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unsafe transition from a collection of Object to an array of String.
|
||
private Qualifier processCollection(Part part, Object value1, Object value2, Iterator<?> parameters, | ||
FilterOperation op, String fieldName) { | ||
String dotPath = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dotPath is always null. Consider passing an explicit null as an argument.
qualifiers[j++] = setQualifierBuilderValues(qb, fieldName, op, part, params.get(i), | ||
null, null, dotPath).build(); | ||
qualifiers[j++] = setQualifier(qb, fieldName, op, part, params.get(i), | ||
null, null, dotPath); | ||
} | ||
|
||
return new AerospikeCriteria(Qualifier.and(qualifiers)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why wrapping with AerospikeCriteria?
Qualifier[] qualifiers; | ||
if (containingMapKeyValuePairs) { | ||
qualifiers = new Qualifier[params.size() / 2]; // keys/values qty must be even | ||
for (int i = 0, j = 0; i < params.size(); i += 2) { | ||
setQbValuesForMapByKey(qb, params.get(i), params.get(i + 1)); | ||
qualifiers[j++] = setQualifierBuilderValues(qb, fieldName, op, part, params.get(i), | ||
null, null, dotPath).build(); | ||
qualifiers[j++] = setQualifier(qb, fieldName, op, part, params.get(i), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Increment j in the increment section of the for statement.
return setQualifier(qb, fieldName, op, part, value1, value2, null, dotPath); | ||
} | ||
|
||
private Qualifier processMapMultipleParams(Part part, Object value1, Object value2, List<Object> params, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check if this method can be refactored/simplified further.
Nothing to add other than @reugn's comments |
No description provided.