public static <T> int compare(T p, T q, String propertyNames) {
ComparisonChain chain = ComparisonChain.start();
for (final Clause clause : iterable(propertyNames)) {
final Comparable<T> propertyValue = (Comparable<T>) clause.getValueOf(p);
final Comparable<T> propertyValue2 = (Comparable<T>) clause.getValueOf(q);
chain = chain.compare(propertyValue, propertyValue2, clause.getDirection().getOrdering());
}
return chain.result();
}
public static <T> Comparator<T> compareBy(final String propertyNames){