クラス SpelQueryContext
java.lang.ObjectSE
org.springframework.data.repository.query.SpelQueryContext
- 既知の直属サブクラス
SpelQueryContext.EvaluatingSpelQueryContext
使用すべきではありません。
SpelQueryContext は、クエリ文字列で SpEL 式を見つけて、バインド変数に置き換えることができます。
解析プロセスの結果は、変換されたクエリ文字列を提供する SpelQueryContext.SpelExtractor
です。代わりに、より強力な SpelQueryContext.EvaluatingSpelQueryContext
を生成する withEvaluationContextProvider(QueryMethodEvaluationContextProvider)
を介して QueryMethodEvaluationContextProvider
を提供することもできます。
典型的な使用箇所は次のようになります
SpelQueryContext.EvaluatingSpelQueryContext queryContext = SpelQueryContext
.of((counter, expression) -> String.format("__$synthetic$__%d", counter), String::concat)
.withEvaluationContextProvider(evaluationContextProvider);
SpelEvaluator spelEvaluator = queryContext.parse(query, queryMethod.getParameters());
spelEvaluator.evaluate(objects).forEach(parameterMap::addValue);
- 導入:
- 2.1
- 作成者:
- Jens Schauder, Gerrit Meier, Mark Paluch
ネストされたクラスのサマリー
修飾子と型クラス説明static class
使用すべきではありません。class
使用すべきではありません。クエリ文字列を解析し、含まれている SpEL 式を識別し、バインドパラメーターに置き換え、それらのバインドパラメーターから SpEL 式にMap
SE を提供します。方法の概要
修飾子と型メソッド説明static SpelQueryContext
of
(BiFunctionSE<IntegerSE, StringSE, StringSE> parameterNameSource, BiFunctionSE<StringSE, StringSE, StringSE> replacementSource) 使用すべきではありません。使用すべきではありません。パターンを使用して SpEL 式のクエリを解析します。使用すべきではありません。現在のものと指定されたQueryMethodEvaluationContextProvider
からSpelQueryContext.EvaluatingSpelQueryContext
を作成します。
メソッドの詳細
of
public static SpelQueryContext of(BiFunctionSE<IntegerSE, StringSE, StringSE> parameterNameSource, BiFunctionSE<StringSE, StringSE, StringSE> replacementSource) 使用すべきではありません。parse
使用すべきではありません。パターンを使用して SpEL 式のクエリを解析します。<prefix>#{<spel>}
接頭辞は文字 ":" または "?" です。解析では、単一引用符または二重引用符で囲まれた引用符付きの文字列が尊重されます。
- パラメーター:
query
- 上記の形式の SpEL 式を含むクエリ。null であってはなりません。- 戻り値:
- SpEL 式がバインドパラメーターに置き換えられたクエリと、バインドパラメーターから SpEL 式へのマップを使用できるようにする
SpelQueryContext.SpelExtractor
。null ではないことが保証されています。
withEvaluationContextProvider
public SpelQueryContext.EvaluatingSpelQueryContext withEvaluationContextProvider(QueryMethodEvaluationContextProvider provider) 使用すべきではありません。現在のものと指定されたQueryMethodEvaluationContextProvider
からSpelQueryContext.EvaluatingSpelQueryContext
を作成します。- パラメーター:
provider
- null であってはなりません。- 戻り値:
ValueExpressionQueryRewriter
を使用してください。