All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.sphere.sdk.queries.CountryQueryModelImpl Maven / Gradle / Ivy

The newest version!
package io.sphere.sdk.queries;

import com.neovisionaries.i18n.CountryCode;

import javax.annotation.Nullable;
import java.util.List;

import static io.sphere.sdk.utils.SphereInternalUtils.toStream;
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 = 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