インターフェース Specification<T>

すべてのスーパーインターフェース:
SerializableSE
すべての既知の実装クラス:
KeysetScrollSpecification
関数インターフェース:
これは関数インターフェースであるため、ラムダ式またはメソッド参照の割り当てターゲットとして使用できます。

@FunctionalInterfaceSE public interface Specification<T> extends SerializableSE
ドメイン駆動設計という意味での仕様。

仕様は、and(Specification)or(Specification)、または allOf(Iterable) などのファクトリメソッドを使用して、他の仕様から高階関数に構成できます。

合成は、1 つ以上の指定が Predicate または null を返すことで述語全体にコントリビュートするかどうかを考慮します。unrestricted() のように null を返す指定は述語全体にコントリビュートしないものとみなされ、その結果は最終的な述語では考慮されません。

作成者:
Oliver Gierke, Thomas Darimont, Krzysztof Rzymkowski, Sebastian Staudt, Mark Paluch, Jens Schauder, Daniel Shuy, Sergey Rukin, Peter Aisher
  • フィールドのサマリー

    フィールド
    修飾子と型
    フィールド
    説明
    static final long
  • メソッドのサマリー

    修飾子と型
    メソッド
    説明
    static <T> Specification<T>
    allOf(IterableSE<Specification<T>> specifications)
    指定されたすべての Specification に AND 演算を適用します。
    static <T> Specification<T>
    allOf(Specification<T>... specifications)
    default Specification<T>
    指定された Specification を現在のものに AND します。
    static <T> Specification<T>
    anyOf(IterableSE<Specification<T>> specifications)
    指定されたすべての Specification に OR 演算を適用します。
    static <T> Specification<T>
    anyOf(Specification<T>... specifications)
    static <T> Specification<T>
    指定された Specification を否定します。
    default Specification<T>
    指定された仕様を現在の仕様に OR します。
    jakarta.persistence.criteria.Predicate
    toPredicate(jakarta.persistence.criteria.Root<T> root, jakarta.persistence.criteria.CriteriaQuery<?> query, jakarta.persistence.criteria.CriteriaBuilder criteriaBuilder)
    指定された Root および CriteriaQuery の Predicate の形式で参照エンティティのクエリの WHERE 句を作成します。
    static <T> Specification<T>
    マッチングに参加しない仕様を作成するための単純な静的ファクトリメソッド。
    static <T> Specification<T>
    非推奨、削除予定: この API 要素は、将来のバージョンで削除される可能性があります。
    3.5 以降、null 仕様をサポートしたくないため、4.0 で削除されます。
  • フィールドの詳細

  • メソッドの詳細

    • not

      static <T> Specification<T> not(@Nullable Specification<T> spec)
      指定された Specification を否定します。
      型パラメーター:
      T - 結果の仕様が動作する Root の型。
      パラメーター:
      spec - null でもかまいません。
      戻り値:
      null でないことが保証されています。
      導入:
      2.0
    • unrestricted

      static <T> Specification<T> unrestricted()
      マッチングに関与しない仕様を作成するためのシンプルな静的ファクトリメソッドです。返される仕様は null -like であり、すべての操作で省略されます。
       unrestricted().and(other) // consider only `other`
       unrestricted().or(other) // consider only `other`
       not(unrestricted()) // equivalent to `unrestricted()`
       
      型パラメーター:
      T - 結果の仕様が動作する Root の型。
      戻り値:
      null でないことが保証されています。
      導入:
      3.5.2
    • where

      @DeprecatedSE(since="3.5.0", forRemoval=true) static <T> Specification<T> where(@Nullable Specification<T> spec)
      非推奨、削除予定: この API 要素は、将来のバージョンで削除される可能性があります。
      3.5 以降、4.0 で削除される予定です。これは、null 指定をサポートしないためです。代わりに unrestricted() を使用してください。
      Specification の周囲に構文糖を追加する単純な静的ファクトリメソッド。
      型パラメーター:
      T - 結果の仕様が動作する Root の型。
      パラメーター:
      spec - null でもかまいません。
      戻り値:
      null でないことが保証されています。
      導入:
      2.0
    • and

      default Specification<T> and(@Nullable Specification<T> other)
      指定された Specification を現在のものに AND します。
      パラメーター:
      other - null でもかまいません。
      戻り値:
      仕様の連動
      導入:
      2.0
    • or

      default Specification<T> or(@Nullable Specification<T> other)
      指定された仕様を現在の仕様に OR します。
      パラメーター:
      other - null でもかまいません。
      戻り値:
      仕様の分離
      導入:
      2.0
    • toPredicate

      @Nullable jakarta.persistence.criteria.Predicate toPredicate(jakarta.persistence.criteria.Root<T> root, @Nullable jakarta.persistence.criteria.CriteriaQuery<?> query, jakarta.persistence.criteria.CriteriaBuilder criteriaBuilder)
      指定された Root および CriteriaQuery の Predicate の形式で参照エンティティのクエリの WHERE 句を作成します。
      パラメーター:
      root - null であってはなりません。
      query - AbstractQuery であるが CriteriaQuery ではない CriteriaDelete を受け入れるオーバーライドを許可するには、null にすることができます。
      criteriaBuilder - null であってはなりません。
      戻り値:
      Predicate、null の場合があります。
    • allOf

      static <T> Specification<T> allOf(IterableSE<Specification<T>> specifications)
      指定されたすべての Specification に AND 演算を適用します。
      パラメーター:
      specifications - 構成する Specificationnull を含めることができます。
      戻り値:
      仕様の連動
      導入:
      3.0
      関連事項:
    • allOf

      @SafeVarargsSE static <T> Specification<T> allOf(Specification<T>... specifications)
      導入:
      3.0
      関連事項:
    • anyOf

      static <T> Specification<T> anyOf(IterableSE<Specification<T>> specifications)
      指定されたすべての Specification に OR 演算を適用します。
      パラメーター:
      specifications - 構成する Specificationnull を含めることができます。
      戻り値:
      仕様の分離
      導入:
      3.0
      関連事項:
    • anyOf

      @SafeVarargsSE static <T> Specification<T> anyOf(Specification<T>... specifications)
      導入:
      3.0
      関連事項: