@Override
        public Number apply(Number num1, Number num2) {
            if (num1.getClass().equals(num2.getClass()) && num1 instanceof Comparable) {
                @SuppressWarnings("unchecked") // The types are interchangeable, guarded by previous check
                Comparable<Number> left = (Comparable<Number>) num1;
                return left.compareTo(num2) < 0 ? num2 : num1;
            } else {
                BigDecimal n1 = new BigDecimal(num1.toString());
                BigDecimal n2 = new BigDecimal(num2.toString());
                return n1.compareTo(n2) < 0 ? num2 : num1;
            }
        }
{@code CollQueryFunctions} defines function implementation for use in ColQueryTemplates

@author tiwe
querydsl-collections/src/main/java/com/querydsl/collections/CollQueryFunctions.java