Module spring.data.mongodb
Class PrefixingDelegatingAggregationOperationContext
java.lang.Object
org.springframework.data.mongodb.core.aggregation.PrefixingDelegatingAggregationOperationContext
- All Implemented Interfaces:
CodecRegistryProvider,AggregationOperationContext
public class PrefixingDelegatingAggregationOperationContext
extends Object
implements AggregationOperationContext
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 denylist.
- Since:
- 2.1
- Author:
- Christoph Strobl, Mark Paluch
-
Constructor Summary
ConstructorsConstructorDescriptionPrefixingDelegatingAggregationOperationContext(AggregationOperationContext delegate, String prefix) PrefixingDelegatingAggregationOperationContext(AggregationOperationContext delegate, String prefix, Collection<String> denylist) -
Method Summary
Modifier and TypeMethodDescriptionorg.bson.codecs.configuration.CodecRegistryGet the underlyingCodecRegistryused by the MongoDB Java driver.Returns theFieldsexposed by the type.org.bson.DocumentgetMappedObject(org.bson.Document document) Returns the mappedDocument, potentially converting the source considering mapping metadata etc.org.bson.DocumentgetMappedObject(org.bson.Document document, Class<?> type) Returns the mappedDocument, potentially converting the source considering mapping metadata for the given type.getReference(String name) Returns theExposedFields.FieldReferencefor the field with the given name.getReference(Field field) Returns aExposedFields.FieldReferencefor the given field.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.data.mongodb.core.aggregation.AggregationOperationContext
continueOnMissingFieldReference, expose, inheritAndExposeMethods inherited from interface org.springframework.data.mongodb.CodecRegistryProvider
getCodecFor, hasCodecFor
-
Constructor Details
-
PrefixingDelegatingAggregationOperationContext
public PrefixingDelegatingAggregationOperationContext(AggregationOperationContext delegate, String prefix) -
PrefixingDelegatingAggregationOperationContext
public PrefixingDelegatingAggregationOperationContext(AggregationOperationContext delegate, String prefix, Collection<String> denylist)
-
-
Method Details
-
getMappedObject
public org.bson.Document getMappedObject(org.bson.Document document) Description copied from interface:AggregationOperationContextReturns the mappedDocument, potentially converting the source considering mapping metadata etc.- Specified by:
getMappedObjectin interfaceAggregationOperationContext- Parameters:
document- will never be null.- Returns:
- must not be null.
-
getMappedObject
Description copied from interface:AggregationOperationContextReturns the mappedDocument, potentially converting the source considering mapping metadata for the given type.- Specified by:
getMappedObjectin interfaceAggregationOperationContext- Parameters:
document- will never be null.type- can be null.- Returns:
- must not be null.
-
getReference
Description copied from interface:AggregationOperationContextReturns aExposedFields.FieldReferencefor the given field.- Specified by:
getReferencein interfaceAggregationOperationContext- Parameters:
field- must not be null.- Returns:
- the
ExposedFields.FieldReferencefor the givenField.
-
getReference
Description copied from interface:AggregationOperationContextReturns theExposedFields.FieldReferencefor the field with the given name.- Specified by:
getReferencein interfaceAggregationOperationContext- Parameters:
name- must not be null or empty.- Returns:
- the
ExposedFields.FieldReferencefor the field with given name.
-
getFields
Description copied from interface:AggregationOperationContextReturns theFieldsexposed by the type. May be a class or an interface. The default implementation usesproperty descriptorsdiscover fields from aClass.- Specified by:
getFieldsin interfaceAggregationOperationContext- Parameters:
type- must not be null.- Returns:
- never null.
- See Also:
-
getCodecRegistry
public org.bson.codecs.configuration.CodecRegistry getCodecRegistry()Description copied from interface:CodecRegistryProviderGet the underlyingCodecRegistryused by the MongoDB Java driver.- Specified by:
getCodecRegistryin interfaceAggregationOperationContext- Specified by:
getCodecRegistryin interfaceCodecRegistryProvider- Returns:
- never null.
-