001package io.ebeaninternal.api;
002
003import io.ebean.ExpressionList;
004import io.ebean.Junction;
005import io.ebeaninternal.server.expression.DocQueryContext;
006
007import java.io.IOException;
008import java.util.List;
009
010/**
011 * Internal extension of ExpressionList.
012 */
013public interface SpiExpressionList<T> extends ExpressionList<T>, SpiExpression {
014
015  /**
016   * Return the expression list as a Junction (for ElasticSearch).
017   */
018  Junction<T> toJunction();
019
020  /**
021   * Return the underlying list of expressions.
022   */
023  List<SpiExpression> getUnderlyingList();
024
025  /**
026   * Return a copy of the ExpressionList with the path trimmed for filterMany() expressions.
027   */
028  SpiExpressionList<?> trimPath(int prefixTrim);
029
030  /**
031   * Return true if this list is empty.
032   */
033  boolean isEmpty();
034
035  /**
036   * Write the top level where expressions taking into account possible extra idEquals expression.
037   */
038  void writeDocQuery(DocQueryContext context, SpiExpression idEquals) throws IOException;
039
040  /**
041   * Apply firstRow maxRows limits on the filterMany query.
042   */
043  default void applyRowLimits(SpiQuery<?> query) {
044    // do nothing by default
045  }
046}