public static String toSortString(final List<Order> orders) {
    if (null == orders || orders.isEmpty()) { return ""; }
    final StringBuilder buf = new StringBuilder("order by ");
    for (final Order order : orders) {
      if (order.isAscending()) {
        buf.append(order.getProperty()).append(',');
      } else {
        buf.append(order.getProperty()).append(" desc,");
      }
    }
    return buf.substring(0, buf.length() - 1).toString();
  }
public static String toSortString ( final List < Order > orders ) { if ( null == orders || orders . isEmpty ( ) ) { return "" ; } final StringBuilder buf = new StringBuilder ( "order by " ) ; for ( final Order order : orders ) { if ( order . isAscending ( ) ) { buf . append ( order . getProperty ( ) ) . append ( ',' ) ; } else { buf . append ( order . getProperty ( ) ) . append ( " desc," ) ; } } return buf . substring ( 0 , buf . length ( ) - 1 ) . toString ( ) ; }
<p>
toSortString.
</p>

@param orders a {@link java.util.List} object.
@return a {@link java.lang.String} object.