diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/AggregationOperationContext.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/AggregationOperationContext.java index 60363db917..0ceb1c84d7 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/AggregationOperationContext.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/AggregationOperationContext.java @@ -81,7 +81,7 @@ default Document getMappedObject(Document document) { /** * Obtain the target field name for a given field/type combination. - * + * * @param type The type containing the field. * @param field The property/field name * @return never {@literal null}. @@ -103,7 +103,7 @@ default String getCollection(Class type) { } /** - * Returns the {@link Fields} exposed by the type. May be a {@literal class} or an {@literal interface}. The default + * Returns the {@link Fields} exposed by the type. Can be a {@literal class} or an {@literal interface}. The default * implementation uses {@link BeanUtils#getPropertyDescriptors(Class) property descriptors} discover fields from a * {@link Class}. * @@ -133,7 +133,7 @@ default Fields getFields(Class type) { /** * This toggle allows the {@link AggregationOperationContext context} to use any given field name without checking for - * its existence. Typically the {@link AggregationOperationContext} fails when referencing unknown fields, those that + * its existence. Typically, the {@link AggregationOperationContext} fails when referencing unknown fields, those that * are not present in one of the previous stages or the input source, throughout the pipeline. * * @return a more relaxed {@link AggregationOperationContext}. diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/LookupOperation.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/LookupOperation.java index 4e4abfb1b3..3cfda35cef 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/LookupOperation.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/LookupOperation.java @@ -109,7 +109,7 @@ public LookupOperation(String from, @Nullable Field localField, @Nullable Field * @param foreignField can be {@literal null} if {@literal pipeline} is present. * @param let can be {@literal null} if {@literal localField} and {@literal foreignField} are present. * @param as must not be {@literal null}. - * @since 4.1 + * @since 4.2 */ private LookupOperation(Object from, @Nullable Field localField, @Nullable Field foreignField, @Nullable Let let, @Nullable AggregationPipeline pipeline, Field as) { @@ -142,11 +142,11 @@ public Document toDocument(AggregationOperationContext context) { Document lookupObject = new Document(); lookupObject.append("from", getCollectionName(context)); - + if (localField != null) { lookupObject.append("localField", localField.getTarget()); } - + if (foreignField != null) { lookupObject.append("foreignField", getForeignFieldName(context)); } @@ -198,7 +198,7 @@ public interface FromBuilder { * Use the given type to determine name of the foreign collection and map * {@link ForeignFieldBuilder#foreignField(String)} against it to consider eventually present * {@link org.springframework.data.mongodb.core.mapping.Field} annotations. - * + * * @param type the type of the target collection in the same database to perform the join with, must not be * {@literal null}. * @return never {@literal null}. diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/PrefixingDelegatingAggregationOperationContext.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/PrefixingDelegatingAggregationOperationContext.java index 4d0ee5ff6c..27b1ab6737 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/PrefixingDelegatingAggregationOperationContext.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/PrefixingDelegatingAggregationOperationContext.java @@ -30,9 +30,8 @@ /** * {@link AggregationOperationContext} implementation prefixing non-command keys on root level with the given prefix. - * Useful when mapping fields to domain specific types while having to prefix keys for query purpose. - *
- * Fields to be excluded from prefixing my be added to a {@literal denylist}. + * Useful when mapping fields to domain specific types while having to prefix keys for query purpose.
+ * Fields to be excluded from prefixing can be added to a {@literal denylist}. * * @author Christoph Strobl * @author Mark Paluch diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/AggregationTestUtils.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/AggregationTestUtils.java index 57e8316224..35e45915f5 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/AggregationTestUtils.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/AggregationTestUtils.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -14,35 +14,18 @@ * limitations under the License. */ -/* - * Copyright 2023 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ package org.springframework.data.mongodb.core.aggregation; import org.springframework.data.mapping.context.MappingContext; import org.springframework.data.mongodb.core.convert.MappingMongoConverter; import org.springframework.data.mongodb.core.convert.NoOpDbRefResolver; import org.springframework.data.mongodb.core.convert.QueryMapper; -import org.springframework.data.mongodb.core.mapping.MongoMappingContext; import org.springframework.data.mongodb.core.mapping.MongoPersistentEntity; import org.springframework.data.mongodb.core.mapping.MongoPersistentProperty; import org.springframework.data.mongodb.test.util.MongoTestMappingContext; /** * @author Christoph Strobl - * @since 2023/06 */ public final class AggregationTestUtils { @@ -92,7 +75,9 @@ public T ctx() { return (T) Aggregation.DEFAULT_CONTEXT; } - MappingContext, MongoPersistentProperty> ctx = mappingContext != null ? mappingContext : MongoTestMappingContext.newTestContext().init(); + MappingContext, MongoPersistentProperty> ctx = mappingContext != null + ? mappingContext + : MongoTestMappingContext.newTestContext().init(); QueryMapper qm = queryMapper != null ? queryMapper : new QueryMapper(new MappingMongoConverter(NoOpDbRefResolver.INSTANCE, ctx)); return (T) (strict ? new TypeBasedAggregationOperationContext(targetType, ctx, qm)