public static <T extends Number & Comparable<?>> NumberExpression<T> asNumber(Expression<T> expr) {
        Expression<T> underlyingMixin = ExpressionUtils.extract(expr);
        if (underlyingMixin instanceof PathImpl) {
            return new NumberPath<T>((PathImpl<T>) underlyingMixin);
        } else if (underlyingMixin instanceof OperationImpl) {
            return new NumberOperation<T>((OperationImpl<T>) underlyingMixin);
        } else if (underlyingMixin instanceof TemplateExpressionImpl) {
            return new NumberTemplate<T>((TemplateExpressionImpl<T>) underlyingMixin);
        } else {
            return new NumberExpression<T>(underlyingMixin) {

                private static final long serialVersionUID = -8712299418891960222L;

                @Override
                public <R, C> R accept(Visitor<R, C> v, C context) {
                    return this.mixin.accept(v, context);
                }

                @Override
                public boolean equals(Object o) {
                    if (o == this) {
                        return true;
                    } else if (o instanceof NumberExpression) {
                        NumberExpression other = (NumberExpression) o;
                        return (other.mixin.equals(this.mixin));
                    } else {
                        return false;
                    }
                }

            };
        }
    }
Create a new NumberExpression

@param expr Expression of type Number
@return new NumberExpression
querydsl-core/src/main/java/com/querydsl/core/types/dsl/Expressions.java