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 Enums in CaseBuilder #635

dmitrygusev opened this Issue Jan 21, 2014 · 1 comment


None yet
2 participants

This is similar to #574 but for enums. Supporting enums allows ordering and aggregation on EnumExpression, that are not available for SimpleExpression.

Something like this may work:

public <T extends Enum<T>> Cases<T,EnumExpression<T>> then(EnumExpression<T> expr) {
    return thenEnum(expr);

private <T extends Enum<T>> Cases<T,EnumExpression<T>> thenEnum(EnumExpression<T> expr) {

    Class<T> enumClass = (Class<T>) expr.getType();

    return new Cases<T,EnumExpression<T>>(enumClass) {
        protected EnumExpression<T> createResult(Class<T> type, Expression<T> last)
            return EnumOperation.create(type, Ops.CASE, last);
    }.addCase(when, expr);

timowest added a commit that referenced this issue Jan 21, 2014


This comment has been minimized.

Show comment
Hide comment

timowest Feb 8, 2014


Released in 3.3.1


timowest commented Feb 8, 2014

Released in 3.3.1

@timowest timowest closed this Feb 8, 2014

@timowest timowest added this to the 3.3.1 milestone Apr 13, 2014

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