code: public static <T extends Enum<T>> EnumExpression<T> asEnum(Expression<T> expr) {
          Expression<T> underlyingMixin = ExpressionUtils.extract(expr);
          if (underlyingMixin instanceof PathImpl) {
              return new EnumPath<T>((PathImpl<T>) underlyingMixin);
          } else if (underlyingMixin instanceof OperationImpl) {
              return new EnumOperation<T>((OperationImpl<T>) underlyingMixin);
          } else if (underlyingMixin instanceof TemplateExpressionImpl) {
              return new EnumTemplate<T>((TemplateExpressionImpl<T>) underlyingMixin);
          } else {
              return new EnumExpression<T>(underlyingMixin) {
  
                  private static final long serialVersionUID = 949681836002045152L;
  
                  @Override
                  public <R, C> R accept(Visitor<R, C> v, C context) {
                      return this.mixin.accept(v, context);
                  }
  
              };
          }
  
      }
docs: Create a new EnumExpression
  
  @param expr Expression of type Enum
  @return new EnumExpression