Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for DateExpression in CaseBuilder #574

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

Support for DateExpression in CaseBuilder #574

dmitrygusev opened this issue Nov 28, 2013 · 1 comment
Milestone

Comments

@dmitrygusev
Copy link

@dmitrygusev dmitrygusev commented Nov 28, 2013

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);
        }
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants