io.sphere.sdk.search.MoneyCentAmountSearchModel Maven / Gradle / Ivy
package io.sphere.sdk.search;
import javax.annotation.Nullable;
import static java.util.Arrays.asList;
public class MoneyCentAmountSearchModel extends RangeTermModelImpl implements SearchSortingModel {
public MoneyCentAmountSearchModel(@Nullable final SearchModel parent, final String pathSegment) {
super(parent, pathSegment);
}
@Override
public RangedFilterSearchModel filtered() {
return new RangedFilterSearchModel<>(this, null, TypeSerializer.ofMoneyCentAmount());
}
@Override
public RangedFacetSearchModel faceted() {
return new RangedFacetSearchModel<>(this, null, TypeSerializer.ofMoneyCentAmount());
}
@Override
public SearchSort sorted(S sortDirection) {
if (hasPath(asList("variants", "price", "centAmount"))) {
return new SphereSearchSort<>(new MoneyCentAmountSearchModel<>(null, "price"), sortDirection);
} else {
return new SphereSearchSort<>(this, sortDirection);
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy