クラス ExpressionEvaluatingSqlParameterSourceFactory

java.lang.ObjectSE
org.springframework.integration.util.AbstractExpressionEvaluator
org.springframework.integration.jdbc.ExpressionEvaluatingSqlParameterSourceFactory
実装されたすべてのインターフェース:
AwareBeanFactoryAwareInitializingBeanSqlParameterSourceFactory

public class ExpressionEvaluatingSqlParameterSourceFactory extends AbstractExpressionEvaluator implements SqlParameterSourceFactory
Spring EL 式を評価する SqlParameterSource を作成する SqlParameterSourceFactory の実装。さらに、ユーザーは常に優先される静的パラメーターを指定できます。
導入:
2.0
作成者:
Dave Syer, Oleg Zhurakousky, Gary Russell, Artem Bilan, Meherzad Lahewala
  • コンストラクターの詳細

    • ExpressionEvaluatingSqlParameterSourceFactory

      public ExpressionEvaluatingSqlParameterSourceFactory()
  • メソッドの詳細

    • setStaticParameters

      public void setStaticParameters(MapSE<StringSE,ObjectSE> staticParameters)
      いくつかの静的パラメーター値を定義します。これらは parameterExpressions で式として定義されているものよりも優先されるため、クエリのパラメーターは最初にここから入力され、次に式から入力されます。
      パラメーター:
      staticParameters - 設定する静的パラメーター
    • setParameterExpressions

      public void setParameterExpressions(MapSE<StringSE,StringSE> parameterExpressions)
      オプションで、パラメーター名を明示的な式にマップします。Spring での名前付きパラメーターのサポートは、特殊文字のない単純なパラメーター名に限定されているため、この機能を使用すると、SQL クエリで単純な名前を指定し、実行時に式に変換できます。式のターゲットはコンテキストに依存します。通常、送信設定ではメッセージであり、受信設定では結果セット行(マップまたは RowMapper が提供されている場合はドメインオブジェクト)です。static parameters は、変数 #staticParameters を使用する式で参照できます。例:

      パラメーター式のサンプル
      キー 値 (式)SQL の例
      idpayload.businessKeyselect * from items where id=:id
      日付 headers['timestamp']select * from items where created>:date
      キー #staticParameters['foo'].toUpperCase()select * from items where name=:key
      パラメーター:
      parameterExpressions - 設定するパラメーター式
    • setSqlParameterTypes

      public void setSqlParameterTypes(MapSE<StringSE,IntegerSE> sqlParametersTypes)
      パラメーターの SQL 型を指定します。オプション。TypesSE を使用して、パラメーター型の値を取得します。
      パラメーター:
      sqlParametersTypes - 使用するパラメーター型
      導入:
      5.0
      関連事項:
    • createParameterSource

      public SqlParameterSource createParameterSource(ObjectSE input)
      インターフェースからコピーされた説明: SqlParameterSourceFactory
      新しい SqlParameterSource を返します。
      次で指定:
      インターフェース SqlParameterSourceFactorycreateParameterSource 
      パラメーター:
      input - SqlParameterSource に変換される生のメッセージまたはクエリ結果
      戻り値:
      パラメーターソース。
    • createParameterSourceNoCache

      public SqlParameterSource createParameterSourceNoCache(ObjectSE input)
      結果をキャッシュしない SqlParameterSource を評価する式を作成します。たとえば、select-sql-parameter-source 属性の <int-jdbc:inbound-channel-adapter/> でソースが複数回使用される場合に役立ちます。
      パラメーター:
      input - 評価のルートオブジェクト。
      戻り値:
      パラメーターソース。
    • onInit

      protected void onInit()
      オーバーライド:
      クラス AbstractExpressionEvaluatoronInit