// Path: rsql-querydsl-parent/rsql-querydsl-filter/src/main/java/com/github/vineey/rql/querydsl/filter/UnsupportedRqlOperatorException.java
// public class UnsupportedRqlOperatorException extends UnsupportedOperationException {
//     public UnsupportedRqlOperatorException(ComparisonNode comparisonNode, Class<? extends Expression> pathClass) {
//         super("The comparison operator within expression [" + comparisonNode.toString() + "] is not supported on type " + pathClass.getSimpleName() + ".");
//     }
// }
// 
// Path: rsql-querydsl-parent/rsql-querydsl-filter/src/main/java/com/github/vineey/rql/querydsl/filter/util/ConverterUtil.java
// public final class ConverterUtil {
// 
//     public static Object convert(Class<?> clazz, String arg) {
//         if (NULL.equalsIgnoreCase(arg)) {
//             return null;
//         } else if (Number.class.isAssignableFrom(clazz)) {
//             Class<? extends Number> numberClass = (Class<? extends Number>) clazz;
//             return convertToNumber(numberClass, arg);
//         } else {
//             throw new UnsupportedOperationException("Conversion not support for " + clazz);
// 
//         }
// 
//     }
// 
//     public static <E extends Number> Number convertToNumber(Class<E> clazz, String arg) {
//         if (clazz.equals(Long.class)) {
//             return Long.valueOf(arg);
//         } else if (clazz.equals(Double.class)) {
//             return Double.valueOf(arg);
//         } else if (clazz.equals(Integer.class)) {
//             return Integer.valueOf(arg);
//         } else if (clazz.equals(BigDecimal.class)) {
//             return new BigDecimal(arg);
//         } else if (clazz.equals(Short.class)) {
//             return new Short(arg);
//         } else if (clazz.equals(BigInteger.class)) {
//             return new BigInteger(arg);
//         } else if (clazz.equals(Float.class)) {
//             return Float.valueOf(arg);
//         } else {
//             throw new UnsupportedOperationException("Conversion to Number doesn't support " + clazz);
//         }
//     }
// }


import static cz.jirutka.rsql.parser.ast.RSQLOperators.*;
import com.github.vineey.rql.querydsl.filter.UnsupportedRqlOperatorException;
import com.github.vineey.rql.querydsl.filter.util.ConverterUtil;
import com.google.common.collect.Lists;
import com.querydsl.core.types.dsl.BooleanExpression;
import com.querydsl.core.types.dsl.NumberPath;
import cz.jirutka.rsql.parser.ast.ComparisonNode;
import cz.jirutka.rsql.parser.ast.ComparisonOperator;
import java.util.List;
        } else if (NOT_EQUAL.equals(comparisonOperator)) {
            return firstNumberArg == null ? path.isNotNull() : path.ne(firstNumberArg);
        } else if (IN.equals(comparisonOperator)) {
            return path.in(convertToNumberArguments(path, arguments));
        } else if (NOT_IN.equals(comparisonOperator)) {
            return path.notIn(convertToNumberArguments(path, arguments));
        } else if (GREATER_THAN.equals(comparisonOperator)) {
            return path.gt(firstNumberArg);
        } else if (GREATER_THAN_OR_EQUAL.equals(comparisonOperator)) {
            return path.goe(firstNumberArg);
        } else if (LESS_THAN.equals(comparisonOperator)) {
            return path.lt(firstNumberArg);
        } else if (LESS_THAN_OR_EQUAL.equals(comparisonOperator)) {
            return path.loe(firstNumberArg);
        }

        throw new UnsupportedRqlOperatorException(comparisonNode, path.getClass());

    }

    private List<Number> convertToNumberArguments(NumberPath path, List<String> arguments) {
        List<Number> numberArgs = Lists.newArrayList();
        for (String arg : arguments) {
            numberArgs.add(convertToNumber(path, arg));
        }
        return numberArgs;
    }

    private Number convertToNumber(NumberPath path, String firstArg) {
        return ConverterConstant.NULL.equalsIgnoreCase(firstArg) ? null
// Path: rsql-querydsl-parent/rsql-querydsl-filter/src/main/java/com/github/vineey/rql/querydsl/filter/UnsupportedRqlOperatorException.java
// public class UnsupportedRqlOperatorException extends UnsupportedOperationException {
//     public UnsupportedRqlOperatorException(ComparisonNode comparisonNode, Class<? extends Expression> pathClass) {
//         super("The comparison operator within expression [" + comparisonNode.toString() + "] is not supported on type " + pathClass.getSimpleName() + ".");
//     }
// }
// 
// Path: rsql-querydsl-parent/rsql-querydsl-filter/src/main/java/com/github/vineey/rql/querydsl/filter/util/ConverterUtil.java
// public final class ConverterUtil {
// 
//     public static Object convert(Class<?> clazz, String arg) {
//         if (NULL.equalsIgnoreCase(arg)) {
//             return null;
//         } else if (Number.class.isAssignableFrom(clazz)) {
//             Class<? extends Number> numberClass = (Class<? extends Number>) clazz;
//             return convertToNumber(numberClass, arg);
//         } else {
//             throw new UnsupportedOperationException("Conversion not support for " + clazz);
// 
//         }
// 
//     }
// 
//     public static <E extends Number> Number convertToNumber(Class<E> clazz, String arg) {
//         if (clazz.equals(Long.class)) {
//             return Long.valueOf(arg);
//         } else if (clazz.equals(Double.class)) {
//             return Double.valueOf(arg);
//         } else if (clazz.equals(Integer.class)) {
//             return Integer.valueOf(arg);
//         } else if (clazz.equals(BigDecimal.class)) {
//             return new BigDecimal(arg);
//         } else if (clazz.equals(Short.class)) {
//             return new Short(arg);
//         } else if (clazz.equals(BigInteger.class)) {
//             return new BigInteger(arg);
//         } else if (clazz.equals(Float.class)) {
//             return Float.valueOf(arg);
//         } else {
//             throw new UnsupportedOperationException("Conversion to Number doesn't support " + clazz);
//         }
//     }
// }


// Path: rsql-querydsl-parent/rsql-querydsl-filter/src/main/java/com/github/vineey/rql/querydsl/filter/converter/NumberPathConverter.java
import static cz.jirutka.rsql.parser.ast.RSQLOperators.*;
import com.github.vineey.rql.querydsl.filter.UnsupportedRqlOperatorException;
import com.github.vineey.rql.querydsl.filter.util.ConverterUtil;
import com.google.common.collect.Lists;
import com.querydsl.core.types.dsl.BooleanExpression;
import com.querydsl.core.types.dsl.NumberPath;
import cz.jirutka.rsql.parser.ast.ComparisonNode;
import cz.jirutka.rsql.parser.ast.ComparisonOperator;
import java.util.List;

        } else if (NOT_EQUAL.equals(comparisonOperator)) {
            return firstNumberArg == null ? path.isNotNull() : path.ne(firstNumberArg);
        } else if (IN.equals(comparisonOperator)) {
            return path.in(convertToNumberArguments(path, arguments));
        } else if (NOT_IN.equals(comparisonOperator)) {
            return path.notIn(convertToNumberArguments(path, arguments));
        } else if (GREATER_THAN.equals(comparisonOperator)) {
            return path.gt(firstNumberArg);
        } else if (GREATER_THAN_OR_EQUAL.equals(comparisonOperator)) {
            return path.goe(firstNumberArg);
        } else if (LESS_THAN.equals(comparisonOperator)) {
            return path.lt(firstNumberArg);
        } else if (LESS_THAN_OR_EQUAL.equals(comparisonOperator)) {
            return path.loe(firstNumberArg);
        }

        throw new UnsupportedRqlOperatorException(comparisonNode, path.getClass());

    }

    private List<Number> convertToNumberArguments(NumberPath path, List<String> arguments) {
        List<Number> numberArgs = Lists.newArrayList();
        for (String arg : arguments) {
            numberArgs.add(convertToNumber(path, arg));
        }
        return numberArgs;
    }

    private Number convertToNumber(NumberPath path, String firstArg) {
        return ConverterConstant.NULL.equalsIgnoreCase(firstArg) ? null
                : ConverterUtil.convertToNumber(path.getType(), firstArg);