public class TypeBasedAggregationOperationContext extends Object implements AggregationOperationContext
AggregationOperationContext
aware of a particular type and a MappingContext
to potentially translate
property references into document field names.Constructor and Description |
---|
TypeBasedAggregationOperationContext(Class<?> type,
MappingContext<? extends MongoPersistentEntity<?>,MongoPersistentProperty> mappingContext,
QueryMapper mapper)
Creates a new
TypeBasedAggregationOperationContext for the given type, MappingContext and
QueryMapper . |
Modifier and Type | Method and Description |
---|---|
Fields |
getFields(Class<?> type)
Returns the
Fields exposed by the type. |
org.bson.Document |
getMappedObject(org.bson.Document document)
Returns the mapped
Document , potentially converting the source considering mapping metadata etc. |
org.bson.Document |
getMappedObject(org.bson.Document document,
Class<?> type)
Returns the mapped
Document , potentially converting the source considering mapping metadata for the given
type. |
ExposedFields.FieldReference |
getReference(Field field)
Returns a
ExposedFields.FieldReference for the given field. |
ExposedFields.FieldReference |
getReference(String name)
Returns the
ExposedFields.FieldReference for the field with the given name. |
public TypeBasedAggregationOperationContext(Class<?> type, MappingContext<? extends MongoPersistentEntity<?>,MongoPersistentProperty> mappingContext, QueryMapper mapper)
TypeBasedAggregationOperationContext
for the given type, MappingContext
and
QueryMapper
.type
- must not be null.mappingContext
- must not be null.mapper
- must not be null.public org.bson.Document getMappedObject(org.bson.Document document)
AggregationOperationContext
Document
, potentially converting the source considering mapping metadata etc.getMappedObject
in interface AggregationOperationContext
document
- will never be null.public org.bson.Document getMappedObject(org.bson.Document document, @Nullable Class<?> type)
AggregationOperationContext
Document
, potentially converting the source considering mapping metadata for the given
type.getMappedObject
in interface AggregationOperationContext
document
- will never be null.type
- can be null.public ExposedFields.FieldReference getReference(Field field)
AggregationOperationContext
ExposedFields.FieldReference
for the given field.getReference
in interface AggregationOperationContext
field
- must not be null.ExposedFields.FieldReference
for the given Field
.public ExposedFields.FieldReference getReference(String name)
AggregationOperationContext
ExposedFields.FieldReference
for the field with the given name.getReference
in interface AggregationOperationContext
name
- must not be null or empty.ExposedFields.FieldReference
for the field with given name.public Fields getFields(Class<?> type)
AggregationOperationContext
Fields
exposed by the type. May be a class or an interface. The default
implementation uses property descriptors
discover fields from a
Class
.getFields
in interface AggregationOperationContext
type
- must not be null.BeanUtils.getPropertyDescriptor(Class, String)
Copyright © 2011–2020 Pivotal Software, Inc.. All rights reserved.