public List < Order > create ( OrderBy order ) { List < Order > list = new ArrayList <> ( ) ; for ( SortSpecification sort : order . getSort ( ) ) { if ( sort . getSortOrder ( ) == SortOrder . DESC ) { list . add ( cb . desc ( root . get ( sort . getKey ( ) ) ) ) ; } else if ( sort . getSortOrder ( ) == SortOrder . ASC ) { list . add ( cb . asc ( root . get ( sort . getKey ( ) ) ) ) ; } } return list ; }
Converts an OrderBy clause to a list of javax . persistence Order instances given a Root and a CriteriaBuilder .