Skip to content

Commit 4734a29

Browse files
mp911dechristophstrobl
authored andcommitted
DATAMONGO-1719 - Rename blocking fluent entry interfaces from …Operation to Executable… and remove Operation from intermediate interfaces.
Original Pull Request: spring-projects#487
1 parent a6a0bde commit 4734a29

23 files changed

+199
-197
lines changed

spring-data-mongodb-benchmarks/src/main/java/org/springframework/data/mongodb/core/ProjectionsBenchmark.java

+7-7
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
import org.openjdk.jmh.annotations.TearDown;
2222
import org.springframework.beans.factory.annotation.Value;
2323
import org.springframework.data.annotation.Id;
24-
import org.springframework.data.mongodb.core.ExecutableFindOperation.FindOperationWithQuery;
25-
import org.springframework.data.mongodb.core.ExecutableFindOperation.TerminatingFindOperation;
24+
import org.springframework.data.mongodb.core.ExecutableFindOperation.FindWithQuery;
25+
import org.springframework.data.mongodb.core.ExecutableFindOperation.TerminatingFind;
2626
import org.springframework.data.mongodb.core.mapping.Field;
2727
import org.springframework.data.mongodb.core.query.BasicQuery;
2828
import org.springframework.data.mongodb.microbenchmark.AbstractMicrobenchmark;
@@ -45,12 +45,12 @@ public class ProjectionsBenchmark extends AbstractMicrobenchmark {
4545

4646
private Person source;
4747

48-
private FindOperationWithQuery<Person> asPerson;
49-
private FindOperationWithQuery<DtoProjection> asDtoProjection;
50-
private FindOperationWithQuery<ClosedProjection> asClosedProjection;
51-
private FindOperationWithQuery<OpenProjection> asOpenProjection;
48+
private FindWithQuery<Person> asPerson;
49+
private FindWithQuery<DtoProjection> asDtoProjection;
50+
private FindWithQuery<ClosedProjection> asClosedProjection;
51+
private FindWithQuery<OpenProjection> asOpenProjection;
5252

53-
private TerminatingFindOperation<Person> asPersonWithFieldsRestriction;
53+
private TerminatingFind<Person> asPersonWithFieldsRestriction;
5454
private Document fields = new Document("firstname", 1);
5555

5656
@Setup

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/ExecutableAggregationOperation.java

+11-12
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* <code>
3232
* aggregateAndReturn(Jedi.class)
3333
* .by(newAggregation(Human.class, project("These are not the droids you are looking for")))
34-
* .get();
34+
* .all();
3535
* </code>
3636
* </pre>
3737
*
@@ -47,28 +47,28 @@ public interface ExecutableAggregationOperation {
4747
* input type for he aggregation.
4848
*
4949
* @param domainType must not be {@literal null}.
50-
* @return new instance of {@link AggregationOperation}.
50+
* @return new instance of {@link ExecutableAggregation}.
5151
* @throws IllegalArgumentException if domainType is {@literal null}.
5252
*/
53-
<T> AggregationOperation<T> aggregateAndReturn(Class<T> domainType);
53+
<T> ExecutableAggregation<T> aggregateAndReturn(Class<T> domainType);
5454

5555
/**
5656
* Collection override (Optional).
5757
*
5858
* @author Christoph Strobl
5959
* @since 2.0
6060
*/
61-
interface AggregationOperationWithCollection<T> {
61+
interface AggregationWithCollection<T> {
6262

6363
/**
6464
* Explicitly set the name of the collection to perform the query on. <br />
6565
* Skip this step to use the default collection derived from the domain type.
6666
*
6767
* @param collection must not be {@literal null} nor {@literal empty}.
68-
* @return new instance of {@link AggregationOperationWithAggregation}.
68+
* @return new instance of {@link AggregationWithAggregation}.
6969
* @throws IllegalArgumentException if collection is {@literal null}.
7070
*/
71-
AggregationOperationWithAggregation<T> inCollection(String collection);
71+
AggregationWithAggregation<T> inCollection(String collection);
7272
}
7373

7474
/**
@@ -77,7 +77,7 @@ interface AggregationOperationWithCollection<T> {
7777
* @author Christoph Strobl
7878
* @since 2.0
7979
*/
80-
interface TerminatingAggregationOperation<T> {
80+
interface TerminatingAggregation<T> {
8181

8282
/**
8383
* Apply pipeline operations as specified and get all matching elements.
@@ -102,22 +102,21 @@ interface TerminatingAggregationOperation<T> {
102102
* @author Christoph Strobl
103103
* @since 2.0
104104
*/
105-
interface AggregationOperationWithAggregation<T> {
105+
interface AggregationWithAggregation<T> {
106106

107107
/**
108108
* Set the aggregation to be used.
109109
*
110110
* @param aggregation must not be {@literal null}.
111-
* @return new instance of {@link TerminatingAggregationOperation}.
111+
* @return new instance of {@link TerminatingAggregation}.
112112
* @throws IllegalArgumentException if aggregation is {@literal null}.
113113
*/
114-
TerminatingAggregationOperation<T> by(Aggregation aggregation);
114+
TerminatingAggregation<T> by(Aggregation aggregation);
115115
}
116116

117117
/**
118118
* @author Christoph Strobl
119119
* @since 2.0
120120
*/
121-
interface AggregationOperation<T>
122-
extends AggregationOperationWithCollection<T>, AggregationOperationWithAggregation<T> {}
121+
interface ExecutableAggregation<T> extends AggregationWithCollection<T>, AggregationWithAggregation<T> {}
123122
}

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/ExecutableAggregationOperationSupport.java

+9-8
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
* Implementation of {@link ExecutableAggregationOperation} operating directly on {@link MongoTemplate}.
2929
*
3030
* @author Christoph Strobl
31+
* @author Mark Paluch
3132
* @since 2.0
3233
*/
3334
class ExecutableAggregationOperationSupport implements ExecutableAggregationOperation {
@@ -48,40 +49,40 @@ class ExecutableAggregationOperationSupport implements ExecutableAggregationOper
4849
}
4950

5051
@Override
51-
public <T> AggregationOperation<T> aggregateAndReturn(Class<T> domainType) {
52+
public <T> ExecutableAggregation<T> aggregateAndReturn(Class<T> domainType) {
5253

5354
Assert.notNull(domainType, "DomainType must not be null!");
5455

55-
return new AggregationOperationSupport<>(template, null, domainType, null);
56+
return new ExecutableAggregationSupport<>(template, null, domainType, null);
5657
}
5758

5859
/**
5960
* @author Christoph Strobl
6061
* @since 2.0
6162
*/
6263
@RequiredArgsConstructor
63-
static class AggregationOperationSupport<T>
64-
implements AggregationOperationWithAggregation<T>, AggregationOperation<T>, TerminatingAggregationOperation<T> {
64+
static class ExecutableAggregationSupport<T>
65+
implements AggregationWithAggregation<T>, ExecutableAggregation<T>, TerminatingAggregation<T> {
6566

6667
private final MongoTemplate template;
6768
private final Aggregation aggregation;
6869
private final Class<T> domainType;
6970
private final String collection;
7071

7172
@Override
72-
public AggregationOperationWithAggregation<T> inCollection(String collection) {
73+
public AggregationWithAggregation<T> inCollection(String collection) {
7374

7475
Assert.hasText(collection, "Collection must not be null nor empty!");
7576

76-
return new AggregationOperationSupport<>(template, aggregation, domainType, collection);
77+
return new ExecutableAggregationSupport<>(template, aggregation, domainType, collection);
7778
}
7879

7980
@Override
80-
public TerminatingAggregationOperation<T> by(Aggregation aggregation) {
81+
public TerminatingAggregation<T> by(Aggregation aggregation) {
8182

8283
Assert.notNull(aggregation, "Aggregation must not be null!");
8384

84-
return new AggregationOperationSupport<>(template, aggregation, domainType, collection);
85+
return new ExecutableAggregationSupport<>(template, aggregation, domainType, collection);
8586
}
8687

8788
@Override

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/ExecutableFindOperation.java

+17-17
Original file line numberDiff line numberDiff line change
@@ -54,18 +54,18 @@ public interface ExecutableFindOperation {
5454
* Start creating a find operation for the given {@literal domainType}.
5555
*
5656
* @param domainType must not be {@literal null}.
57-
* @return new instance of {@link FindOperation}.
57+
* @return new instance of {@link ExecutableFind}.
5858
* @throws IllegalArgumentException if domainType is {@literal null}.
5959
*/
60-
<T> FindOperation<T> query(Class<T> domainType);
60+
<T> ExecutableFind<T> query(Class<T> domainType);
6161

6262
/**
6363
* Trigger find execution by calling one of the terminating methods.
6464
*
6565
* @author Christoph Strobl
6666
* @since 2.0
6767
*/
68-
interface TerminatingFindOperation<T> {
68+
interface TerminatingFind<T> {
6969

7070
/**
7171
* Get exactly zero or one result.
@@ -137,7 +137,7 @@ default Optional<T> first() {
137137
* @author Christoph Strobl
138138
* @since 2.0
139139
*/
140-
interface TerminatingFindNearOperation<T> {
140+
interface TerminatingFindNear<T> {
141141

142142
/**
143143
* Find all matching elements and return them as {@link org.springframework.data.geo.GeoResult}.
@@ -153,25 +153,25 @@ interface TerminatingFindNearOperation<T> {
153153
* @author Christoph Strobl
154154
* @since 2.0
155155
*/
156-
interface FindOperationWithQuery<T> extends TerminatingFindOperation<T> {
156+
interface FindWithQuery<T> extends TerminatingFind<T> {
157157

158158
/**
159159
* Set the filter query to be used.
160160
*
161161
* @param query must not be {@literal null}.
162-
* @return new instance of {@link TerminatingFindOperation}.
162+
* @return new instance of {@link TerminatingFind}.
163163
* @throws IllegalArgumentException if query is {@literal null}.
164164
*/
165-
TerminatingFindOperation<T> matching(Query query);
165+
TerminatingFind<T> matching(Query query);
166166

167167
/**
168168
* Set the filter query for the geoNear execution.
169169
*
170170
* @param nearQuery must not be {@literal null}.
171-
* @return new instance of {@link TerminatingFindNearOperation}.
171+
* @return new instance of {@link TerminatingFindNear}.
172172
* @throws IllegalArgumentException if nearQuery is {@literal null}.
173173
*/
174-
TerminatingFindNearOperation<T> near(NearQuery nearQuery);
174+
TerminatingFindNear<T> near(NearQuery nearQuery);
175175
}
176176

177177
/**
@@ -180,17 +180,17 @@ interface FindOperationWithQuery<T> extends TerminatingFindOperation<T> {
180180
* @author Christoph Strobl
181181
* @since 2.0
182182
*/
183-
interface FindOperationWithCollection<T> extends FindOperationWithQuery<T> {
183+
interface FindWithCollection<T> extends FindWithQuery<T> {
184184

185185
/**
186186
* Explicitly set the name of the collection to perform the query on. <br />
187187
* Skip this step to use the default collection derived from the domain type.
188188
*
189189
* @param collection must not be {@literal null} nor {@literal empty}.
190-
* @return new instance of {@link FindOperationWithProjection}.
190+
* @return new instance of {@link FindWithProjection}.
191191
* @throws IllegalArgumentException if collection is {@literal null}.
192192
*/
193-
FindOperationWithProjection<T> inCollection(String collection);
193+
FindWithProjection<T> inCollection(String collection);
194194
}
195195

196196
/**
@@ -199,25 +199,25 @@ interface FindOperationWithCollection<T> extends FindOperationWithQuery<T> {
199199
* @author Christoph Strobl
200200
* @since 2.0
201201
*/
202-
interface FindOperationWithProjection<T> extends FindOperationWithQuery<T> {
202+
interface FindWithProjection<T> extends FindWithQuery<T> {
203203

204204
/**
205205
* Define the target type fields should be mapped to. <br />
206206
* Skip this step if you are anyway only interested in the original domain type.
207207
*
208208
* @param resultType must not be {@literal null}.
209209
* @param <R> result type.
210-
* @return new instance of {@link FindOperationWithProjection}.
210+
* @return new instance of {@link FindWithProjection}.
211211
* @throws IllegalArgumentException if resultType is {@literal null}.
212212
*/
213-
<R> FindOperationWithQuery<R> as(Class<R> resultType);
213+
<R> FindWithQuery<R> as(Class<R> resultType);
214214
}
215215

216216
/**
217-
* {@link FindOperation} provides methods for constructing lookup operations in a fluent way.
217+
* {@link ExecutableFind} provides methods for constructing lookup operations in a fluent way.
218218
*
219219
* @author Christoph Strobl
220220
* @since 2.0
221221
*/
222-
interface FindOperation<T> extends FindOperationWithCollection<T>, FindOperationWithProjection<T> {}
222+
interface ExecutableFind<T> extends FindWithCollection<T>, FindWithProjection<T> {}
223223
}

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/ExecutableFindOperationSupport.java

+11-11
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ class ExecutableFindOperationSupport implements ExecutableFindOperation {
6161
}
6262

6363
@Override
64-
public <T> FindOperation<T> query(Class<T> domainType) {
64+
public <T> ExecutableFind<T> query(Class<T> domainType) {
6565

6666
Assert.notNull(domainType, "DomainType must not be null!");
6767

68-
return new FindOperationSupport<>(template, domainType, domainType, null, ALL_QUERY);
68+
return new ExecutableFindSupport<>(template, domainType, domainType, null, ALL_QUERY);
6969
}
7070

7171
/**
@@ -74,8 +74,8 @@ public <T> FindOperation<T> query(Class<T> domainType) {
7474
* @since 2.0
7575
*/
7676
@RequiredArgsConstructor
77-
static class FindOperationSupport<T> implements FindOperation<T>, FindOperationWithCollection<T>,
78-
FindOperationWithProjection<T>, FindOperationWithQuery<T> {
77+
static class ExecutableFindSupport<T>
78+
implements ExecutableFind<T>, FindWithCollection<T>, FindWithProjection<T>, FindWithQuery<T> {
7979

8080
private final MongoTemplate template;
8181
private final Class<?> domainType;
@@ -84,27 +84,27 @@ static class FindOperationSupport<T> implements FindOperation<T>, FindOperationW
8484
private final Query query;
8585

8686
@Override
87-
public FindOperationWithProjection<T> inCollection(String collection) {
87+
public FindWithProjection<T> inCollection(String collection) {
8888

8989
Assert.hasText(collection, "Collection name must not be null nor empty!");
9090

91-
return new FindOperationSupport<>(template, domainType, returnType, collection, query);
91+
return new ExecutableFindSupport<>(template, domainType, returnType, collection, query);
9292
}
9393

9494
@Override
95-
public <T1> FindOperationWithQuery<T1> as(Class<T1> returnType) {
95+
public <T1> FindWithQuery<T1> as(Class<T1> returnType) {
9696

9797
Assert.notNull(returnType, "ReturnType must not be null!");
9898

99-
return new FindOperationSupport<>(template, domainType, returnType, collection, query);
99+
return new ExecutableFindSupport<>(template, domainType, returnType, collection, query);
100100
}
101101

102102
@Override
103-
public TerminatingFindOperation<T> matching(Query query) {
103+
public TerminatingFind<T> matching(Query query) {
104104

105105
Assert.notNull(query, "Query must not be null!");
106106

107-
return new FindOperationSupport<>(template, domainType, returnType, collection, query);
107+
return new ExecutableFindSupport<>(template, domainType, returnType, collection, query);
108108
}
109109

110110
@Override
@@ -142,7 +142,7 @@ public Stream<T> stream() {
142142
}
143143

144144
@Override
145-
public TerminatingFindNearOperation<T> near(NearQuery nearQuery) {
145+
public TerminatingFindNear<T> near(NearQuery nearQuery) {
146146
return () -> template.geoNear(nearQuery, domainType, getCollectionName(), returnType);
147147
}
148148

0 commit comments

Comments
 (0)