io.sphere.sdk.search.SphereSearchSort Maven / Gradle / Ivy
package io.sphere.sdk.search;
import static io.sphere.sdk.utils.IterableUtils.toStream;
import static java.util.stream.Collectors.joining;
public class SphereSearchSort extends SearchSortBase {
private final SearchModel path;
private final SearchSortDirection direction;
protected SphereSearchSort(SearchModel path, SearchSortDirection direction) {
this.path = path;
this.direction = direction;
}
public String toSphereSort() {
return renderPath(path) + " " + directionToString();
}
private String directionToString() {
return direction.toString().toLowerCase().replace("_", ".");
}
private String renderPath(final SearchModel model) {
return toStream(model.buildPath()).collect(joining("."));
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy