Support for DateExpression in CaseBuilder #574

Closed
dmitrygusev opened this Issue Nov 28, 2013 · 1 comment

Comments

Projects
None yet
2 participants
@dmitrygusev

Right now I can create Cases instance and pass DateExpression to then method, but resulting expression will be instance of SimpleOperation and I cannot use it in orderBy clause because it doesn't implement ComparableExpressionBase.

What I want is something like this:

public final class CaseBuilder {
    // ...
    public static class Initial {
        // ...
        public Cases<Date,DateExpression<Date>> then(DateExpression<Date> expr) {
            return thenDate(expr);
        }

        private Cases<Date, DateExpression<Date>> thenDate(DateExpression<Date> expr) {
            return new Cases<Date, DateExpression<Date>>(Date.class) {
                @Override
                protected DateExpression<Date> createResult(Class<Date> type, Expression<Date> last) {
                    return DateOperation.create(Date.class, Ops.CASE, last);
                }

            }.addCase(when, expr);
        }
    }
}
@timowest

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest Dec 12, 2013

Member

Released in 3.3.0.BETA2

Member

timowest commented Dec 12, 2013

Released in 3.3.0.BETA2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment