io.sphere.sdk.queries.CountryQueryModelImpl Maven / Gradle / Ivy
package io.sphere.sdk.queries;
import com.neovisionaries.i18n.CountryCode;
import io.sphere.sdk.utils.IterableUtils;
import javax.annotation.Nullable;
import java.util.List;
import static java.util.stream.Collectors.toList;
final class CountryQueryModelImpl extends QueryModelImpl implements CountryQueryModel {
public CountryQueryModelImpl(@Nullable final QueryModel parent, @Nullable final String pathSegment) {
super(parent, pathSegment);
}
@Override
public QueryPredicate is(final CountryCode countryCode) {
return isPredicate(countryCode.getAlpha2());
}
@Override
public QueryPredicate isIn(final Iterable args) {
final List countryCodesStringList = IterableUtils.toStream(args)
.map(CountryCode::getAlpha2)
.map(code -> '"' + code + '"')
.collect(toList());
return isInPredicate(countryCodesStringList);
}
@Override
public QueryPredicate isNot(final CountryCode countryCode) {
return isNotPredicate(countryCode.getAlpha2());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy