Search in sources :

Example 1 with Comparators

use of com.tvd12.dahlia.core.comparator.Comparators in project dahlia by youngmonkeys.

the class QueryToPredicate method compareValue.

protected int compareValue(Object a, Object b) {
    if (a == null) {
        if (b == null)
            return 0;
        return -1;
    } else {
        if (b == null)
            return 1;
        Comparators comparators = Comparators.getInstance();
        Comparator comparator = comparators.getComparator(a.getClass());
        int result = comparator != null ? comparator.compare(a, b) : ((Comparable) a).compareTo(b);
        return result;
    }
}
Also used : Comparators(com.tvd12.dahlia.core.comparator.Comparators) Comparator(java.util.Comparator)

Aggregations

Comparators (com.tvd12.dahlia.core.comparator.Comparators)1 Comparator (java.util.Comparator)1