Skip to content

Commit 7967902

Browse files
committed
DATAMONGO-2138 - Annotate with author and since
1 parent 6ed8617 commit 7967902

File tree

1 file changed

+78
-0
lines changed
  • spring-data-mongodb/src/main/kotlin/org/springframework/data/mongodb/core/query

1 file changed

+78
-0
lines changed

spring-data-mongodb/src/main/kotlin/org/springframework/data/mongodb/core/query/TypedCriteria.kt

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ class TypedCriteria(
4949

5050
/**
5151
* Creates a criterion using equality.
52+
* @author Tjeu Kayim
53+
* @since 2.2
5254
* @see Criteria.isEqualTo
5355
*/
5456
infix fun <T> KProperty<T>.isEqualTo(value: T) = TypedCriteria({ isEqualTo(value) }, this)
@@ -57,6 +59,8 @@ infix fun <T> KProperty<T>.isEqualTo(value: T) = TypedCriteria({ isEqualTo(value
5759
* Creates a criterion using the $ne operator.
5860
*
5961
* See [MongoDB Query operator: $ne](https://docs.mongodb.com/manual/reference/operator/query/ne/)
62+
* @author Tjeu Kayim
63+
* @since 2.2
6064
* @see Criteria.ne
6165
*/
6266
infix fun <T> KProperty<T>.ne(value: T) = TypedCriteria({ ne(value) }, this)
@@ -65,6 +69,8 @@ infix fun <T> KProperty<T>.ne(value: T) = TypedCriteria({ ne(value) }, this)
6569
* Creates a criterion using the $lt operator.
6670
*
6771
* See [MongoDB Query operator: $lt](https://docs.mongodb.com/manual/reference/operator/query/lt/)
72+
* @author Tjeu Kayim
73+
* @since 2.2
6874
* @see Criteria.lt
6975
*/
7076
infix fun <T> KProperty<T>.lt(value: T) = TypedCriteria({ lt(value) }, this)
@@ -73,6 +79,8 @@ infix fun <T> KProperty<T>.lt(value: T) = TypedCriteria({ lt(value) }, this)
7379
* Creates a criterion using the $lte operator.
7480
*
7581
* See [MongoDB Query operator: $lte](https://docs.mongodb.com/manual/reference/operator/query/lte/)
82+
* @author Tjeu Kayim
83+
* @since 2.2
7684
* @see Criteria.lte
7785
*/
7886
infix fun <T> KProperty<T>.lte(value: T) = TypedCriteria({ lte(value) }, this)
@@ -81,6 +89,8 @@ infix fun <T> KProperty<T>.lte(value: T) = TypedCriteria({ lte(value) }, this)
8189
* Creates a criterion using the $gt operator.
8290
*
8391
* See [MongoDB Query operator: $gt](https://docs.mongodb.com/manual/reference/operator/query/gt/)
92+
* @author Tjeu Kayim
93+
* @since 2.2
8494
* @see Criteria.gt
8595
*/
8696
infix fun <T> KProperty<T>.gt(value: T) = TypedCriteria({ gt(value) }, this)
@@ -89,6 +99,8 @@ infix fun <T> KProperty<T>.gt(value: T) = TypedCriteria({ gt(value) }, this)
8999
* Creates a criterion using the $gte operator.
90100
*
91101
* See [MongoDB Query operator: $gte](https://docs.mongodb.com/manual/reference/operator/query/gte/)
102+
* @author Tjeu Kayim
103+
* @since 2.2
92104
* @see Criteria.gte
93105
*/
94106
infix fun <T> KProperty<T>.gte(value: T) = TypedCriteria({ gte(value) }, this)
@@ -97,6 +109,8 @@ infix fun <T> KProperty<T>.gte(value: T) = TypedCriteria({ gte(value) }, this)
97109
* Creates a criterion using the $in operator.
98110
*
99111
* See [MongoDB Query operator: $in](https://docs.mongodb.com/manual/reference/operator/query/in/)
112+
* @author Tjeu Kayim
113+
* @since 2.2
100114
* @see Criteria.inValues
101115
*/
102116
fun <T> KProperty<T>.inValues(vararg o: Any) = TypedCriteria({ `in`(*o) }, this)
@@ -105,6 +119,8 @@ fun <T> KProperty<T>.inValues(vararg o: Any) = TypedCriteria({ `in`(*o) }, this)
105119
* Creates a criterion using the $in operator.
106120
*
107121
* See [MongoDB Query operator: $in](https://docs.mongodb.com/manual/reference/operator/query/in/)
122+
* @author Tjeu Kayim
123+
* @since 2.2
108124
* @see Criteria.inValues
109125
*/
110126
infix fun <T> KProperty<T>.inValues(value: Collection<T>) = TypedCriteria({ `in`(value) }, this)
@@ -113,6 +129,8 @@ infix fun <T> KProperty<T>.inValues(value: Collection<T>) = TypedCriteria({ `in`
113129
* Creates a criterion using the $nin operator.
114130
*
115131
* See [MongoDB Query operator: $nin](https://docs.mongodb.com/manual/reference/operator/query/nin/)
132+
* @author Tjeu Kayim
133+
* @since 2.2
116134
* @see Criteria.nin
117135
*/
118136
fun <T> KProperty<T>.nin(vararg o: Any) = TypedCriteria({ nin(*o) }, this)
@@ -121,6 +139,8 @@ fun <T> KProperty<T>.nin(vararg o: Any) = TypedCriteria({ nin(*o) }, this)
121139
* Creates a criterion using the $nin operator.
122140
*
123141
* See [MongoDB Query operator: $nin](https://docs.mongodb.com/manual/reference/operator/query/nin/)
142+
* @author Tjeu Kayim
143+
* @since 2.2
124144
* @see Criteria.nin
125145
*/
126146
infix fun <T> KProperty<T>.nin(value: Collection<T>) = TypedCriteria({ nin(value) }, this)
@@ -129,6 +149,8 @@ infix fun <T> KProperty<T>.nin(value: Collection<T>) = TypedCriteria({ nin(value
129149
* Creates a criterion using the $mod operator.
130150
*
131151
* See [MongoDB Query operator: $mod](https://docs.mongodb.com/manual/reference/operator/query/mod/)
152+
* @author Tjeu Kayim
153+
* @since 2.2
132154
* @see Criteria.mod
133155
*/
134156
fun KProperty<Number>.mod(value: Number, remainder: Number) = TypedCriteria({ mod(value, remainder) }, this)
@@ -137,6 +159,8 @@ fun KProperty<Number>.mod(value: Number, remainder: Number) = TypedCriteria({ mo
137159
* Creates a criterion using the $all operator.
138160
*
139161
* See [MongoDB Query operator: $all](https://docs.mongodb.com/manual/reference/operator/query/all/)
162+
* @author Tjeu Kayim
163+
* @since 2.2
140164
* @see Criteria.all
141165
*/
142166
fun KProperty<*>.all(vararg o: Any) = TypedCriteria({ all(*o) }, this)
@@ -145,6 +169,8 @@ fun KProperty<*>.all(vararg o: Any) = TypedCriteria({ all(*o) }, this)
145169
* Creates a criterion using the $all operator.
146170
*
147171
* See [MongoDB Query operator: $all](https://docs.mongodb.com/manual/reference/operator/query/all/)
172+
* @author Tjeu Kayim
173+
* @since 2.2
148174
* @see Criteria.all
149175
*/
150176
infix fun KProperty<*>.all(value: Collection<*>) = TypedCriteria({ all(value) }, this)
@@ -153,6 +179,8 @@ infix fun KProperty<*>.all(value: Collection<*>) = TypedCriteria({ all(value) },
153179
* Creates a criterion using the $size operator.
154180
*
155181
* See [MongoDB Query operator: $size](https://docs.mongodb.com/manual/reference/operator/query/size/)
182+
* @author Tjeu Kayim
183+
* @since 2.2
156184
* @see Criteria.size
157185
*/
158186
infix fun KProperty<*>.size(s: Int) = TypedCriteria({ size(s) }, this)
@@ -161,6 +189,8 @@ infix fun KProperty<*>.size(s: Int) = TypedCriteria({ size(s) }, this)
161189
* Creates a criterion using the $exists operator.
162190
*
163191
* See [MongoDB Query operator: $exists](https://docs.mongodb.com/manual/reference/operator/query/exists/)
192+
* @author Tjeu Kayim
193+
* @since 2.2
164194
* @see Criteria.exists
165195
*/
166196
infix fun KProperty<*>.exists(b: Boolean) = TypedCriteria({ exists(b) }, this)
@@ -169,6 +199,8 @@ infix fun KProperty<*>.exists(b: Boolean) = TypedCriteria({ exists(b) }, this)
169199
* Creates a criterion using the $type operator.
170200
*
171201
* See [MongoDB Query operator: $type](https://docs.mongodb.com/manual/reference/operator/query/type/)
202+
* @author Tjeu Kayim
203+
* @since 2.2
172204
* @see Criteria.type
173205
*/
174206
infix fun KProperty<*>.type(t: Int) = TypedCriteria({ type(t) }, this)
@@ -177,6 +209,8 @@ infix fun KProperty<*>.type(t: Int) = TypedCriteria({ type(t) }, this)
177209
* Creates a criterion using the $type operator.
178210
*
179211
* See [MongoDB Query operator: $type](https://docs.mongodb.com/manual/reference/operator/query/type/)
212+
* @author Tjeu Kayim
213+
* @since 2.2
180214
* @see Criteria.type
181215
*/
182216
infix fun KProperty<*>.type(t: Collection<JsonSchemaObject.Type>) = TypedCriteria({ type(*t.toTypedArray()) }, this)
@@ -185,6 +219,8 @@ infix fun KProperty<*>.type(t: Collection<JsonSchemaObject.Type>) = TypedCriteri
185219
* Creates a criterion using the $type operator.
186220
*
187221
* See [MongoDB Query operator: $type](https://docs.mongodb.com/manual/reference/operator/query/type/)
222+
* @author Tjeu Kayim
223+
* @since 2.2
188224
* @see Criteria.type
189225
*/
190226
fun KProperty<*>.type(vararg t: JsonSchemaObject.Type) = TypedCriteria({ type(*t) }, this)
@@ -193,6 +229,8 @@ fun KProperty<*>.type(vararg t: JsonSchemaObject.Type) = TypedCriteria({ type(*t
193229
* Creates a criterion using the $not meta operator which affects the clause directly following
194230
*
195231
* See [MongoDB Query operator: $not](https://docs.mongodb.com/manual/reference/operator/query/not/)
232+
* @author Tjeu Kayim
233+
* @since 2.2
196234
* @see Criteria.not
197235
*/
198236
fun KProperty<*>.not() = TypedCriteria({ not() }, this)
@@ -201,6 +239,8 @@ fun KProperty<*>.not() = TypedCriteria({ not() }, this)
201239
* Creates a criterion using a $regex operator.
202240
*
203241
* See [MongoDB Query operator: $regex](https://docs.mongodb.com/manual/reference/operator/query/regex/)
242+
* @author Tjeu Kayim
243+
* @since 2.2
204244
* @see Criteria.regex
205245
*/
206246
infix fun KProperty<String?>.regex(re: String) = TypedCriteria({ regex(re, null) }, this)
@@ -209,24 +249,32 @@ infix fun KProperty<String?>.regex(re: String) = TypedCriteria({ regex(re, null)
209249
* Creates a criterion using a $regex and $options operator.
210250
*
211251
* See [MongoDB Query operator: $regex](https://docs.mongodb.com/manual/reference/operator/query/regex/)
252+
* @author Tjeu Kayim
253+
* @since 2.2
212254
* @see Criteria.regex
213255
*/
214256
fun KProperty<String?>.regex(re: String, options: String?) = TypedCriteria({ regex(re, options) }, this)
215257

216258
/**
217259
* Syntactical sugar for [isEqualTo] making obvious that we create a regex predicate.
260+
* @author Tjeu Kayim
261+
* @since 2.2
218262
* @see Criteria.regex
219263
*/
220264
infix fun KProperty<String?>.regex(re: Regex) = TypedCriteria({ regex(re.toPattern()) }, this)
221265

222266
/**
223267
* Syntactical sugar for [isEqualTo] making obvious that we create a regex predicate.
268+
* @author Tjeu Kayim
269+
* @since 2.2
224270
* @see Criteria.regex
225271
*/
226272
infix fun KProperty<String?>.regex(re: Pattern) = TypedCriteria({ regex(re) }, this)
227273

228274
/**
229275
* Syntactical sugar for [isEqualTo] making obvious that we create a regex predicate.
276+
* @author Tjeu Kayim
277+
* @since 2.2
230278
* @see Criteria.regex
231279
*/
232280
infix fun KProperty<String?>.regex(re: BsonRegularExpression) = TypedCriteria({ regex(re) }, this)
@@ -240,6 +288,8 @@ infix fun KProperty<String?>.regex(re: BsonRegularExpression) = TypedCriteria({
240288
*
241289
* See [MongoDB Query operator:
242290
* $centerSphere](https://docs.mongodb.com/manual/reference/operator/query/centerSphere/)
291+
* @author Tjeu Kayim
292+
* @since 2.2
243293
* @see Criteria.withinSphere
244294
*/
245295
infix fun KProperty<GeoJson<*>>.withinSphere(circle: Circle) = TypedCriteria({ withinSphere(circle) }, this)
@@ -249,6 +299,8 @@ infix fun KProperty<GeoJson<*>>.withinSphere(circle: Circle) = TypedCriteria({ w
249299
*
250300
* See [MongoDB Query operator:
251301
* $geoWithin](https://docs.mongodb.com/manual/reference/operator/query/geoWithin/)
302+
* @author Tjeu Kayim
303+
* @since 2.2
252304
* @see Criteria.within
253305
*/
254306
infix fun KProperty<GeoJson<*>>.within(shape: Shape) = TypedCriteria({ within(shape) }, this)
@@ -257,6 +309,8 @@ infix fun KProperty<GeoJson<*>>.within(shape: Shape) = TypedCriteria({ within(sh
257309
* Creates a geospatial criterion using a $near operation.
258310
*
259311
* See [MongoDB Query operator: $near](https://docs.mongodb.com/manual/reference/operator/query/near/)
312+
* @author Tjeu Kayim
313+
* @since 2.2
260314
* @see Criteria.near
261315
*/
262316
infix fun KProperty<GeoJson<*>>.near(point: Point) = TypedCriteria({ near(point) }, this)
@@ -267,13 +321,17 @@ infix fun KProperty<GeoJson<*>>.near(point: Point) = TypedCriteria({ near(point)
267321
*
268322
* See [MongoDB Query operator:
269323
* $nearSphere](https://docs.mongodb.com/manual/reference/operator/query/nearSphere/)
324+
* @author Tjeu Kayim
325+
* @since 2.2
270326
* @see Criteria.nearSphere
271327
*/
272328
infix fun KProperty<GeoJson<*>>.nearSphere(point: Point) = TypedCriteria({ nearSphere(point) }, this)
273329

274330
/**
275331
* Creates criterion using `$geoIntersects` operator which matches intersections of the given `geoJson`
276332
* structure and the documents one. Requires MongoDB 2.4 or better.
333+
* @author Tjeu Kayim
334+
* @since 2.2
277335
* @see Criteria.intersects
278336
*/
279337
infix fun KProperty<GeoJson<*>>.intersects(geoJson: GeoJson<*>) = TypedCriteria({ intersects(geoJson) }, this)
@@ -283,13 +341,17 @@ infix fun KProperty<GeoJson<*>>.intersects(geoJson: GeoJson<*>) = TypedCriteria(
283341
*
284342
* See [MongoDB Query operator:
285343
* $maxDistance](https://docs.mongodb.com/manual/reference/operator/query/maxDistance/)
344+
* @author Tjeu Kayim
345+
* @since 2.2
286346
* @see Criteria.maxDistance
287347
*/
288348
infix fun KProperty<GeoJson<*>>.maxDistance(d: Double) = TypedCriteria({ maxDistance(d) }, this)
289349

290350
/**
291351
* Creates a geospatial criterion using a $minDistance operation, for use with $near or
292352
* $nearSphere.
353+
* @author Tjeu Kayim
354+
* @since 2.2
293355
* @see Criteria.minDistance
294356
*/
295357
infix fun KProperty<GeoJson<*>>.minDistance(d: Double) = TypedCriteria({ minDistance(d) }, this)
@@ -299,6 +361,8 @@ infix fun KProperty<GeoJson<*>>.minDistance(d: Double) = TypedCriteria({ minDist
299361
*
300362
* See [MongoDB Query operator:
301363
* $elemMatch](https://docs.mongodb.com/manual/reference/operator/query/elemMatch/)
364+
* @author Tjeu Kayim
365+
* @since 2.2
302366
* @see Criteria.elemMatch
303367
*/
304368
infix fun KProperty<*>.elemMatch(c: Criteria) = TypedCriteria({ elemMatch(c) }, this)
@@ -308,12 +372,16 @@ infix fun KProperty<*>.elemMatch(c: Criteria) = TypedCriteria({ elemMatch(c) },
308372
*
309373
* See [MongoDB Query operator:
310374
* $elemMatch](https://docs.mongodb.com/manual/reference/operator/query/elemMatch/)
375+
* @author Tjeu Kayim
376+
* @since 2.2
311377
* @see Criteria.elemMatch
312378
*/
313379
infix fun KProperty<*>.elemMatch(c: TypedCriteria) = TypedCriteria({ elemMatch(typedCriteria(c)) }, this)
314380

315381
/**
316382
* Creates a criterion using the given object as a pattern.
383+
* @author Tjeu Kayim
384+
* @since 2.2
317385
* @see Criteria.alike
318386
*/
319387
fun alike(sample: Example<*>) = TypedCriteria({ alike(sample) })
@@ -324,6 +392,8 @@ fun alike(sample: Example<*>) = TypedCriteria({ alike(sample) })
324392
*
325393
* See [MongoDB Query operator:
326394
* $jsonSchema](https://docs.mongodb.com/manual/reference/operator/query/jsonSchema/)
395+
* @author Tjeu Kayim
396+
* @since 2.2
327397
* @see Criteria.andDocumentStructureMatches
328398
*/
329399
infix fun KProperty<*>.andDocumentStructureMatches(schema: MongoJsonSchema) =
@@ -338,6 +408,8 @@ infix fun KProperty<*>.andDocumentStructureMatches(schema: MongoJsonSchema) =
338408
* ```
339409
* bits { allClear(123) }
340410
* ```
411+
* @author Tjeu Kayim
412+
* @since 2.2
341413
* @see Criteria.bits
342414
*/
343415
infix fun KProperty<*>.bits(bitwiseCriteria: Criteria.BitwiseCriteriaOperators.() -> Criteria) =
@@ -347,6 +419,8 @@ infix fun KProperty<*>.bits(bitwiseCriteria: Criteria.BitwiseCriteriaOperators.(
347419
* Creates an 'or' criteria using the $or operator for all of the provided criteria
348420
*
349421
* Note that mongodb doesn't support an $or operator to be wrapped in a $not operator.
422+
* @author Tjeu Kayim
423+
* @since 2.2
350424
* @see Criteria.orOperator
351425
*/
352426
fun orOperator(vararg builders: TypedCriteria) = addOperatorWithCriteria(builders, Criteria::orOperator)
@@ -355,6 +429,8 @@ fun orOperator(vararg builders: TypedCriteria) = addOperatorWithCriteria(builder
355429
* Creates a 'nor' criteria using the $nor operator for all of the provided criteria.
356430
*
357431
* Note that mongodb doesn't support an $nor operator to be wrapped in a $not operator.
432+
* @author Tjeu Kayim
433+
* @since 2.2
358434
* @see Criteria.norOperator
359435
*/
360436
fun norOperator(vararg builders: TypedCriteria) = addOperatorWithCriteria(builders, Criteria::norOperator)
@@ -363,6 +439,8 @@ fun norOperator(vararg builders: TypedCriteria) = addOperatorWithCriteria(builde
363439
* Creates an 'and' criteria using the $and operator for all of the provided criteria.
364440
*
365441
* Note that mongodb doesn't support an $and operator to be wrapped in a $not operator.
442+
* @author Tjeu Kayim
443+
* @since 2.2
366444
* @see Criteria.andOperator
367445
*/
368446
fun andOperator(vararg builders: TypedCriteria) = addOperatorWithCriteria(builders, Criteria::andOperator)

0 commit comments

Comments
 (0)