io.sphere.sdk.queries.ReferenceCollectionQueryModelImpl Maven / Gradle / Ivy
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 extends Referenceable> 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