Polishing.

Reformat code. Add since tags.

See #3395
Original pull request: #3554.
This commit is contained in:
Mark Paluch
2021-02-18 15:08:19 +01:00
parent dca508f3dc
commit f93e40fdee
2 changed files with 9 additions and 4 deletions

View File

@@ -103,8 +103,13 @@ public enum MongoRegexCreator {
} }
} }
/**
* @param source
* @return
* @since 2.2.14
*/
public Object toCaseInsensitiveMatch(Object source) { public Object toCaseInsensitiveMatch(Object source) {
return source instanceof String ? new BsonRegularExpression(Pattern.quote((String)source), "i") : source; return source instanceof String ? new BsonRegularExpression(Pattern.quote((String) source), "i") : source;
} }
private String prepareAndEscapeStringBeforeApplyingLikeRegex(String source, MatchMode matcherType) { private String prepareAndEscapeStringBeforeApplyingLikeRegex(String source, MatchMode matcherType) {

View File

@@ -402,12 +402,12 @@ class MongoQueryCreator extends AbstractQueryCreator<Query, Criteria> {
} }
private java.util.List<?> nextAsList(Iterator<Object> iterator, Part part) { private java.util.List<?> nextAsList(Iterator<Object> iterator, Part part) {
Streamable<?> streamable = asStreamable(iterator.next()); Streamable<?> streamable = asStreamable(iterator.next());
if(!isSimpleComparisionPossible(part)) { if (!isSimpleComparisionPossible(part)) {
streamable = streamable.map(MongoRegexCreator.INSTANCE::toCaseInsensitiveMatch); streamable = streamable.map(MongoRegexCreator.INSTANCE::toCaseInsensitiveMatch);
} }
return streamable.toList(); return streamable.toList();
} }