Requirement: Create a Comparator for sorting based on different fields
Usage: Allow customers to sort by different columns of a data set.
Solution:
cFirst = (Comparable) first.getClass().getField(cf).get(first);
cSecond = (Comparable) second.getClass().getField(cf).get(second);
return (corder.booleanValue())?cFirst.compareTo(cSecond):cSecond.compareTo(cFirst);