io.sphere.sdk.search.model.SortSearchModelImpl Maven / Gradle / Ivy
package io.sphere.sdk.search.model;
import io.sphere.sdk.models.Base;
import io.sphere.sdk.search.SearchSortDirection;
import io.sphere.sdk.search.SortExpression;
import static io.sphere.sdk.search.SearchSortDirection.ASC;
import static io.sphere.sdk.search.SearchSortDirection.DESC;
/**
* A sort model to decide the direction of a model with single values.
* This class is abstract to force the subclass to select the methods that need to be highlighted and/or extended.
* @param type of the resource
*/
abstract class SortSearchModelImpl extends Base implements SortSearchModel {
private final SearchModel searchModel;
SortSearchModelImpl(final SearchModel searchModel) {
this.searchModel = searchModel;
}
public SortExpression by(final SearchSortDirection direction) {
return new SortExpressionImpl<>(searchModel, direction);
}
/**
* @return the ascending sort direction
*/
public SortExpression byAsc() {
return by(ASC);
}
/**
* @return the descending sort direction
*/
public SortExpression byDesc() {
return by(DESC);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy