public abstract class AbstractMongoQuery extends Object implements RepositoryQuery
RepositoryQuery implementations for Mongo.| Constructor and Description |
|---|
AbstractMongoQuery(MongoQueryMethod method,
MongoOperations operations,
ExpressionParser expressionParser,
QueryMethodEvaluationContextProvider evaluationContextProvider)
|
| Modifier and Type | Method and Description |
|---|---|
protected Query |
createCountQuery(ConvertingParameterAccessor accessor)
Creates a
Query instance using the given ConvertingParameterAccessor. |
protected abstract Query |
createQuery(ConvertingParameterAccessor accessor)
Creates a
Query instance using the given ParameterAccessor |
protected UpdateDefinition |
createUpdate(ConvertingParameterAccessor accessor)
|
protected org.bson.Document |
decode(String source,
ParameterBindingContext bindingContext) |
protected Object |
doExecute(MongoQueryMethod method,
ResultProcessor processor,
ConvertingParameterAccessor accessor,
Class<?> typeToRead)
Execute the
RepositoryQuery of the given method with the parameters provided by the
accessor |
Object |
execute(Object[] parameters) |
protected org.bson.codecs.configuration.CodecRegistry |
getCodecRegistry() |
protected ParameterBindingDocumentCodec |
getParameterBindingCodec()
Obtain the
ParameterBindingDocumentCodec used for parsing JSON expressions. |
MongoQueryMethod |
getQueryMethod() |
protected SpELExpressionEvaluator |
getSpELExpressionEvaluatorFor(ExpressionDependencies dependencies,
ConvertingParameterAccessor accessor)
Obtain a the
EvaluationContext suitable to evaluate expressions backed by the given dependencies. |
protected abstract boolean |
isCountQuery()
Returns whether the query should get a count projection applied.
|
protected abstract boolean |
isDeleteQuery()
Return weather the query should delete matching documents.
|
protected abstract boolean |
isExistsQuery()
Returns whether the query should get an exists projection applied.
|
protected abstract boolean |
isLimiting()
Return whether the query has an explicit limit set.
|
protected List<AggregationOperation> |
parseAggregationPipeline(String[] sourcePipeline,
ConvertingParameterAccessor accessor)
Parse the given aggregation pipeline stages applying values to placeholders to compute the actual list of
operations. |
protected ParameterBindingContext |
prepareBindingContext(String source,
ConvertingParameterAccessor accessor)
Create the
binding context used for SpEL evaluation. |
public AbstractMongoQuery(MongoQueryMethod method, MongoOperations operations, ExpressionParser expressionParser, QueryMethodEvaluationContextProvider evaluationContextProvider)
method - must not be null.operations - must not be null.expressionParser - must not be null.evaluationContextProvider - must not be null.public MongoQueryMethod getQueryMethod()
getQueryMethod in interface RepositoryQuerypublic Object execute(Object[] parameters)
execute in interface RepositoryQueryprotected Object doExecute(MongoQueryMethod method, ResultProcessor processor, ConvertingParameterAccessor accessor, @Nullable Class<?> typeToRead)
RepositoryQuery of the given method with the parameters provided by the
accessormethod - the MongoQueryMethod invoked. Never null.processor - ResultProcessor for post procession. Never null.accessor - for providing invocation arguments. Never null.typeToRead - the desired component target type. Can be null.protected Query createCountQuery(ConvertingParameterAccessor accessor)
Query instance using the given ConvertingParameterAccessor. Will delegate to
createQuery(ConvertingParameterAccessor) by default but allows customization of the count query to be
triggered.accessor - must not be null.protected UpdateDefinition createUpdate(ConvertingParameterAccessor accessor)
update from the given
accessor or creates
one via by parsing the annotated statement extracted from Update.accessor - never null.UpdateDefinition.IllegalStateException - if no update could be found.protected List<AggregationOperation> parseAggregationPipeline(String[] sourcePipeline, ConvertingParameterAccessor accessor)
operations.sourcePipeline - must not be null.accessor - must not be null.protected org.bson.Document decode(String source, ParameterBindingContext bindingContext)
protected ParameterBindingContext prepareBindingContext(String source, ConvertingParameterAccessor accessor)
binding context used for SpEL evaluation.source - the JSON source.accessor - value provider for parameter binding.protected ParameterBindingDocumentCodec getParameterBindingCodec()
ParameterBindingDocumentCodec used for parsing JSON expressions.protected SpELExpressionEvaluator getSpELExpressionEvaluatorFor(ExpressionDependencies dependencies, ConvertingParameterAccessor accessor)
EvaluationContext suitable to evaluate expressions backed by the given dependencies.dependencies - must not be null.accessor - must not be null.SpELExpressionEvaluator.protected org.bson.codecs.configuration.CodecRegistry getCodecRegistry()
CodecRegistry used.protected abstract Query createQuery(ConvertingParameterAccessor accessor)
Query instance using the given ParameterAccessoraccessor - must not be null.protected abstract boolean isCountQuery()
protected abstract boolean isExistsQuery()
protected abstract boolean isDeleteQuery()
protected abstract boolean isLimiting()
Copyright © 2011–2022 Pivotal Software, Inc.. All rights reserved.