File tree Expand file tree Collapse file tree 3 files changed +90
-54
lines changed
main/kotlin/org/springframework/data/mongodb/core/query
test/kotlin/org/springframework/data/mongodb/core/query Expand file tree Collapse file tree 3 files changed +90
-54
lines changed Original file line number Diff line number Diff line change @@ -315,7 +315,7 @@ class TypedCriteriaBuilder {
315
315
addOperation { andDocumentStructureMatches(schema) }
316
316
317
317
/* *
318
- * Use [BitwiseCriteriaOperators] as gateway to create a criterion using one of the
318
+ * Use [Criteria. BitwiseCriteriaOperators] as gateway to create a criterion using one of the
319
319
* [bitwise operators](https://docs.mongodb.com/manual/reference/operator/query-bitwise/) like
320
320
* `$bitsAllClear`.
321
321
*
@@ -358,7 +358,7 @@ class TypedCriteriaBuilder {
358
358
fun and (vararg builders : TypedCriteria ) = addOperatorWithCriteria(builders, Criteria ::andOperator)
359
359
360
360
private fun addOperatorWithCriteria (builders : Array <out TypedCriteria >, operation : Criteria .(Array <Criteria >) -> Criteria ) {
361
- val otherCriteria = builders.map { TypedCriteriaBuilder (). apply ( it) }.map { it.criteria }
361
+ val otherCriteria = builders.map { typedCriteria( it) }
362
362
criteria.operation(otherCriteria.toTypedArray())
363
363
}
364
364
Original file line number Diff line number Diff line change @@ -22,20 +22,17 @@ package org.springframework.data.mongodb.core.query
22
22
* @sample typedCriteriaSample
23
23
* @author Tjeu Kayim
24
24
*/
25
- fun typedCriteria (criteria : TypedCriteria ): Criteria {
26
- val builder = TypedCriteriaBuilder ().apply (criteria)
27
- return builder.criteria
28
- }
25
+ fun typedCriteria (criteria : TypedCriteria ): Criteria =
26
+ TypedCriteriaBuilder ().apply (criteria).criteria
29
27
30
28
/* *
31
29
* Shorthand for `Query(typedCriteria())`.
32
30
*
33
31
* @see typedCriteria
34
32
* @author Tjeu Kayim
35
33
*/
36
- fun typedQuery (criteria : TypedCriteria ): Query {
37
- return Query (typedCriteria(criteria))
38
- }
34
+ fun typedQuery (criteria : TypedCriteria ): Query =
35
+ Query (typedCriteria(criteria))
39
36
40
37
private fun typedCriteriaSample () {
41
38
class Author (val name : String )
You can’t perform that action at this time.
0 commit comments