Skip to content

Commit 434fd79

Browse files
committed
DATAMONGO-2138 - Comments & Copyright
1 parent adf230f commit 434fd79

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2010-2018 the original author or authors.
2+
* Copyright 2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -31,10 +31,9 @@ import kotlin.reflect.KProperty1
3131
typealias TypedCriteria = TypedCriteriaBuilder.() -> Unit
3232

3333
/**
34-
* Builds typed criteria.
35-
* Used as receiver for [typedCriteria].
34+
* Build [Criteria] with Property References as field names.
35+
* Used by the functions [typedCriteria] and [typedQuery].
3636
*
37-
* @see typedCriteria
3837
* @author Tjeu Kayim
3938
*/
4039
class TypedCriteriaBuilder {
@@ -365,8 +364,9 @@ class TypedCriteriaBuilder {
365364

366365
/**
367366
* Build nested properties.
367+
* Refer to a field in a embedded/nested document.
368368
*
369-
* Example:
369+
* For example, referring to the field "book.author":
370370
* ```
371371
* Book::author / Author::name isEqualTo "Herman Melville"
372372
* ```

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2010-2018 the original author or authors.
2+
* Copyright 2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -16,7 +16,7 @@
1616
package org.springframework.data.mongodb.core.query
1717

1818
/**
19-
* Typed criteria builder.
19+
* Build [Criteria] with Property References as field names.
2020
*
2121
* @see typedQuery
2222
* @sample typedCriteriaSample
@@ -28,7 +28,7 @@ fun typedCriteria(criteria: TypedCriteria): Criteria {
2828
}
2929

3030
/**
31-
* Create a new Query.
31+
* Shorthand for `Query(typedCriteria())`.
3232
*
3333
* @see typedCriteria
3434
* @author Tjeu Kayim
@@ -40,20 +40,20 @@ fun typedQuery(criteria: TypedCriteria): Query {
4040
private fun typedCriteriaSample() {
4141
class Author(val name: String)
4242
class Book(val name: String, val price: Int, val author: Author)
43-
// Build typed criteria
43+
// Use Property References for field names
4444
typedCriteria {
4545
Book::name isEqualTo "Moby-Dick"
46-
Book::price lt 950
46+
Book::price exists true
4747
}
48-
// $or operator
48+
// $or, $nor, $and operators
4949
typedCriteria {
5050
Book::name isEqualTo "Moby-Dick"
5151
or(
5252
{ Book::price lt 1200 },
5353
{ Book::price gt 240 }
5454
)
5555
}
56-
// Nested properties
56+
// Nested Properties (i.e. refer to "book.author")
5757
typedCriteria {
5858
Book::author / Author::name regex "^H"
5959
}

spring-data-mongodb/src/test/kotlin/org/springframework/data/mongodb/core/query/TypedCriteriaExtensionsTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2010-2018 the original author or authors.
2+
* Copyright 2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

0 commit comments

Comments
 (0)