{
final ColumnSort sort = constraint.getColumnSort();
if (sort == ColumnSort.UNSORTED) continue;
final PropertyConduit conduit = constraint.getPropertyModel().getConduit();
final Comparator valueComparator = new Comparator<Comparable>()
{
public int compare(Comparable o1, Comparable o2)
{
// Simplify comparison, and handle case where both are nulls.
if (o1 == o2) return 0;
if (o2 == null) return 1;
if (o1 == null) return -1;
return o1.compareTo(o2);
}
};
final Comparator rowComparator = new Comparator()
{
public int compare(Object row1, Object row2)
{
Comparable value1 = (Comparable) conduit.get(row1);
Comparable value2 = (Comparable) conduit.get(row2);
return valueComparator.compare(value1, value2);
}
};