I didn't find anywhere whether it's possible to create pageable manually from string, let assume that we have the following service method
public <T> List<T> findAnything(final int page, final int size, final String sort) { // e.g. id,desc&username,asc
final Pageable pageable = new PageRequest(page, size, null);
return null;
}
my question is how can i instantiate an object of
org.springframework.data.domain.Sort
from a given string of format, important note that these parameters are chagned dynamically, so more likely i need a path to the spring parser, in my example im passing null instead the object
id,desc&username,asc
EDIT
A little bit more details I'm looking for a mechanism of how spring converts the 'sort' string(with the rest of default parameters) that's coming to the rest endpoint as a query param to Pageable object