private Cases<String,StringExpression> thenString(Expression<String> expr) {
            return new Cases<String,StringExpression>(String.class) {
                @SuppressWarnings("unchecked")
                @Override
                protected StringExpression createResult(Class<? extends String> type, Expression<String> last) {
                    return Expressions.stringOperation(Ops.CASE, last);
                }

            }.addCase(when, expr);
        }
Initial state of Case construction

@author tiwe
querydsl-core/src/main/java/com/querydsl/core/types/dsl/CaseBuilder.java