April 2018
Intermediate to advanced
202 pages
4h 48m
English
As we have previously discussed, the DataProvider interface uses an object of type List<QuerySortOrder> to provide the ordering configuration. However, the backend service requires an object of type Map<String, Boolean>. We have to implement a helper method that translates between these two types. We can add this method to a separate DataUtils class and implement it as follows:
public class DataUtils { public static <T, F> Map<String, Boolean> getOrderMap( Query<T, F> query) { Map<String, Boolean> map = new LinkedHashMap<>(); for (QuerySortOrder order : query.getSortOrders()) { String property = order.getSorted(); boolean isAscending = SortDirection.ASCENDING.equals( order.getDirection()); map.put(property, isAscending) ...
Read now
Unlock full access