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

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

There is a newer version: 1.0.0-M26
Show newest version
package io.sphere.sdk.queries;

import io.sphere.sdk.models.Referenceable;

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

import static io.sphere.sdk.utils.IterableUtils.toStream;
import static java.util.stream.Collectors.toList;

final class ReferenceCollectionQueryModelImpl extends QueryModelImpl implements ReferenceCollectionQueryModel {
    public ReferenceCollectionQueryModelImpl(@Nullable final QueryModel parent, @Nullable final String pathSegment) {
        super(parent, pathSegment);
    }

    @Override
    public final QueryPredicate isIn(final Iterable> references) {
        final List ids = toStream(references).map(r -> r.toReference().getId()).collect(toList());
        return stringModel("id").isIn(ids);
    }

    @Override
    public QueryPredicate isEmpty() {
        return isEmptyCollectionQueryPredicate();
    }

    @Override
    public QueryPredicate isNotEmpty() {
        return isNotEmptyCollectionQueryPredicate();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy