-
Notifications
You must be signed in to change notification settings - Fork 682
Add ValueExpression
infrastructure for query methods
#3050
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
d2d5256
to
3629ff8
Compare
@@ -66,55 +81,38 @@ public ExtensionAwareQueryMethodEvaluationContextProvider(List<? extends Evaluat | |||
|
|||
Assert.notNull(extensions, "EvaluationContextExtensions must not be null"); | |||
|
|||
this.delegate = new org.springframework.data.spel.ExtensionAwareEvaluationContextProvider(extensions); | |||
this.delegate = new QueryMethodValueEvaluationContextAccessor(null, extensions); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are we using null
here for the Environment
? In L:71 a new StandardEnvironment
is passed on.
parameters.stream()// | ||
.filter(Parameter::isSpecialParameter)// | ||
.forEach(it -> variables.put(// | ||
StringUtils.uncapitalize(it.getType().getSimpleName()), // | ||
arguments[it.getIndex()])); | ||
|
||
parameters.stream()// | ||
.filter(Parameter::isNamedParameter)// | ||
.forEach(it -> variables.put(// | ||
it.getName().orElseThrow(() -> new IllegalStateException("Should never occur")), // | ||
arguments[it.getIndex()])); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can't we put this in one stream processing instead of running over parameters twice?
if (evaluationContext instanceof StandardEvaluationContext sec | ||
&& rootObject instanceof Object[] parameterValues) { | ||
sec.setVariables(collectVariables(parameters, parameterValues)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add variables for a given SimpleEvaluationContext
as well?
bc3a03e
to
ba80df6
Compare
Introduce ValueExpressionQueryRewriter as replacement for SpelQueryContext and QueryMethodValueEvaluationContextAccessor to encapsulate common ValueExpression functionality for Spring Data modules wanting to resolve Value Expressions in query methods. Reduce dependencies in RepositoryFactoryBeanSupport and RepositoryFactorySupport to EvaluationContextProvider instead of QueryMethodEvaluationContextProvider to simplify dependencies. Deprecate QueryMethodEvaluationContextProvider and its reactive variant for future removal. Closes #3049
414ff4f
to
c1d8d93
Compare
… a EvaluatingValueExpressionQueryRewriter directly.
Introduce ValueExpressionQueryRewriter as replacement for SpelQueryContext and QueryMethodValueEvaluationContextAccessor to encapsulate common ValueExpression functionality for Spring Data modules wanting to resolve Value Expressions in query methods. Reduce dependencies in RepositoryFactoryBeanSupport and RepositoryFactorySupport to EvaluationContextProvider instead of QueryMethodEvaluationContextProvider to simplify dependencies. Deprecate QueryMethodEvaluationContextProvider and its reactive variant for future removal. Closes #3049 Original pull request: #3050
Introduce
ValueExpressionQueryRewriter
as replacement forSpelQueryContext
.Closes #3049