title: QueryDSL: How can I create a predicate from a case expression?
body: <p>Using QueryDSL, I want to create a <code>Predicate</code> from a case expression that returns boolean expressions:</p>
  
  <pre><code>public static Predicate examplePredicate(NumberPath&lt;Integer&gt; typePath, DateTimePath&lt;Date&gt; timestampPath) {
      final Expression&lt;Boolean&gt; expr = typePath
          .when(0).then(timestampPath.lt(currentTimestamp()))
          .when(1).then(timestampPath.goe(currentTimestamp()))
          .otherwise(false);
      // How can I create a predicate from expr?
  }
  </code></pre>
  
  <p>All <code>then</code> clauses of the case expression return <code>BooleanExpression</code>s - which implements <code>Predicate</code> - but the <code>expr</code> itself is of type <code>Expression&lt;Boolean&gt;</code>.</p>
  
  <p>How can I create a <code>Predicate</code> (probably a <code>BooleanExpression</code>) from such a case expression?</p>