Skip to content

Commit 4974e00

Browse files
committed
Add javadoc for save operations.
Closes #1495.
1 parent fab3f55 commit 4974e00

File tree

3 files changed

+42
-5
lines changed

3 files changed

+42
-5
lines changed

src/main/java/org/springframework/data/couchbase/core/CouchbaseOperations.java

+20
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,28 @@ public interface CouchbaseOperations extends FluentCouchbaseOperations {
5454
*/
5555
QueryScanConsistency getConsistency();
5656

57+
/**
58+
* Save the entity to couchbase.<br>
59+
* If there is no version property on the entity class, and this is in a transaction, use insert. <br>
60+
* If there is no version property on the entity class, and this is not in a transaction, use upsert. <br>
61+
* If there is a version property on the entity class, and it is non-zero, then this is an existing document, use
62+
* replace.<br>
63+
* Otherwise, there is a version property for the entity, but it is zero or null, use insert. <br>
64+
*
65+
* @param entity the entity to save in couchbase
66+
* @param scopeAndCollection for use by repositories only. these are varargs for the scope and collection.
67+
* @param <T> the entity class
68+
* @return
69+
*/
5770
<T> T save(T entity, String... scopeAndCollection);
5871

72+
/**
73+
* Returns the count of documents found by the query.
74+
* @param query
75+
* @param domainType
76+
* @param <T>
77+
* @return
78+
*/
5979
<T> Long count(Query query, Class<T> domainType);
6080

6181
}

src/main/java/org/springframework/data/couchbase/core/ReactiveCouchbaseOperations.java

+21-1
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,29 @@ public interface ReactiveCouchbaseOperations extends ReactiveFluentCouchbaseOper
5252
*/
5353
CouchbaseClientFactory getCouchbaseClientFactory();
5454

55+
/**
56+
* Save the entity to couchbase.<br>
57+
* If there is no version property on the entity class, and this is in a transaction, use insert. <br>
58+
* If there is no version property on the entity class, and this is not in a transaction, use upsert. <br>
59+
* If there is a version property on the entity class, and it is non-zero, then this is an existing document, use
60+
* replace.<br>
61+
* Otherwise, there is a version property for the entity, but it is zero or null, use insert. <br>
62+
*
63+
* @param entity the entity to save in couchbase
64+
* @param scopeAndCollection for use by repositories only. these are varargs for the scope and collection.
65+
* @param <T> the entity class
66+
* @return
67+
*/
5568
<T> Mono<T> save(T entity, String... scopeAndCollection);
5669

57-
<T> Mono<Long> count(Query query, Class<T> personClass);
70+
/**
71+
* Returns the count of documents found by the query.
72+
* @param query
73+
* @param domainType
74+
* @param <T>
75+
* @return
76+
*/
77+
<T> Mono<Long> count(Query query, Class<T> domainType);
5878

5979
/**
6080
* @return the default consistency to use for queries

src/main/java/org/springframework/data/couchbase/core/ReactiveCouchbaseTemplate.java

+1-4
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,7 @@ public ReactiveCouchbaseTemplate(final CouchbaseClientFactory clientFactory, fin
7272
this.scanConsistency = scanConsistency;
7373
}
7474

75-
public <T> Mono<T> save(T entity) {
76-
return save(entity, null, null);
77-
}
78-
75+
@Override
7976
public <T> Mono<T> save(T entity, String... scopeAndCollection) {
8077
Assert.notNull(entity, "Entity must not be null!");
8178
String scope = scopeAndCollection.length > 0 ? scopeAndCollection[0] : null;

0 commit comments

Comments
 (0)