Skip to content

Commit 7103ca2

Browse files
committed
Polishing.
Reformatting, trailing whitespaces.
1 parent b46aab2 commit 7103ca2

File tree

4 files changed

+13
-29
lines changed

4 files changed

+13
-29
lines changed

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ default Document getMappedObject(Document document) {
8181

8282
/**
8383
* Obtain the target field name for a given field/type combination.
84-
*
84+
*
8585
* @param type The type containing the field.
8686
* @param field The property/field name
8787
* @return never {@literal null}.
@@ -103,7 +103,7 @@ default String getCollection(Class<?> type) {
103103
}
104104

105105
/**
106-
* Returns the {@link Fields} exposed by the type. May be a {@literal class} or an {@literal interface}. The default
106+
* Returns the {@link Fields} exposed by the type. Can be a {@literal class} or an {@literal interface}. The default
107107
* implementation uses {@link BeanUtils#getPropertyDescriptors(Class) property descriptors} discover fields from a
108108
* {@link Class}.
109109
*
@@ -133,7 +133,7 @@ default Fields getFields(Class<?> type) {
133133

134134
/**
135135
* This toggle allows the {@link AggregationOperationContext context} to use any given field name without checking for
136-
* its existence. Typically the {@link AggregationOperationContext} fails when referencing unknown fields, those that
136+
* its existence. Typically, the {@link AggregationOperationContext} fails when referencing unknown fields, those that
137137
* are not present in one of the previous stages or the input source, throughout the pipeline.
138138
*
139139
* @return a more relaxed {@link AggregationOperationContext}.

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public LookupOperation(String from, @Nullable Field localField, @Nullable Field
109109
* @param foreignField can be {@literal null} if {@literal pipeline} is present.
110110
* @param let can be {@literal null} if {@literal localField} and {@literal foreignField} are present.
111111
* @param as must not be {@literal null}.
112-
* @since 4.1
112+
* @since 4.2
113113
*/
114114
private LookupOperation(Object from, @Nullable Field localField, @Nullable Field foreignField, @Nullable Let let,
115115
@Nullable AggregationPipeline pipeline, Field as) {
@@ -142,11 +142,11 @@ public Document toDocument(AggregationOperationContext context) {
142142
Document lookupObject = new Document();
143143

144144
lookupObject.append("from", getCollectionName(context));
145-
145+
146146
if (localField != null) {
147147
lookupObject.append("localField", localField.getTarget());
148148
}
149-
149+
150150
if (foreignField != null) {
151151
lookupObject.append("foreignField", getForeignFieldName(context));
152152
}
@@ -198,7 +198,7 @@ public interface FromBuilder {
198198
* Use the given type to determine name of the foreign collection and map
199199
* {@link ForeignFieldBuilder#foreignField(String)} against it to consider eventually present
200200
* {@link org.springframework.data.mongodb.core.mapping.Field} annotations.
201-
*
201+
*
202202
* @param type the type of the target collection in the same database to perform the join with, must not be
203203
* {@literal null}.
204204
* @return never {@literal null}.

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

+2-3
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,8 @@
3030

3131
/**
3232
* {@link AggregationOperationContext} implementation prefixing non-command keys on root level with the given prefix.
33-
* Useful when mapping fields to domain specific types while having to prefix keys for query purpose.
34-
* <br />
35-
* Fields to be excluded from prefixing my be added to a {@literal denylist}.
33+
* Useful when mapping fields to domain specific types while having to prefix keys for query purpose. <br />
34+
* Fields to be excluded from prefixing can be added to a {@literal denylist}.
3635
*
3736
* @author Christoph Strobl
3837
* @author Mark Paluch

spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/AggregationTestUtils.java

+4-19
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
77
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
8+
* https://www.apache.org/licenses/LICENSE-2.0
99
*
1010
* Unless required by applicable law or agreed to in writing, software
1111
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,35 +14,18 @@
1414
* limitations under the License.
1515
*/
1616

17-
/*
18-
* Copyright 2023 the original author or authors.
19-
*
20-
* Licensed under the Apache License, Version 2.0 (the "License");
21-
* you may not use this file except in compliance with the License.
22-
* You may obtain a copy of the License at
23-
*
24-
* http://www.apache.org/licenses/LICENSE-2.0
25-
*
26-
* Unless required by applicable law or agreed to in writing, software
27-
* distributed under the License is distributed on an "AS IS" BASIS,
28-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
29-
* See the License for the specific language governing permissions and
30-
* limitations under the License.
31-
*/
3217
package org.springframework.data.mongodb.core.aggregation;
3318

3419
import org.springframework.data.mapping.context.MappingContext;
3520
import org.springframework.data.mongodb.core.convert.MappingMongoConverter;
3621
import org.springframework.data.mongodb.core.convert.NoOpDbRefResolver;
3722
import org.springframework.data.mongodb.core.convert.QueryMapper;
38-
import org.springframework.data.mongodb.core.mapping.MongoMappingContext;
3923
import org.springframework.data.mongodb.core.mapping.MongoPersistentEntity;
4024
import org.springframework.data.mongodb.core.mapping.MongoPersistentProperty;
4125
import org.springframework.data.mongodb.test.util.MongoTestMappingContext;
4226

4327
/**
4428
* @author Christoph Strobl
45-
* @since 2023/06
4629
*/
4730
public final class AggregationTestUtils {
4831

@@ -92,7 +75,9 @@ public T ctx() {
9275
return (T) Aggregation.DEFAULT_CONTEXT;
9376
}
9477

95-
MappingContext<? extends MongoPersistentEntity<?>, MongoPersistentProperty> ctx = mappingContext != null ? mappingContext : MongoTestMappingContext.newTestContext().init();
78+
MappingContext<? extends MongoPersistentEntity<?>, MongoPersistentProperty> ctx = mappingContext != null
79+
? mappingContext
80+
: MongoTestMappingContext.newTestContext().init();
9681
QueryMapper qm = queryMapper != null ? queryMapper
9782
: new QueryMapper(new MappingMongoConverter(NoOpDbRefResolver.INSTANCE, ctx));
9883
return (T) (strict ? new TypeBasedAggregationOperationContext(targetType, ctx, qm)

0 commit comments

Comments
 (0)