Class ResolvedQuery

java.lang.Object
org.apache.juneau.commons.beanquery.ResolvedQuery

public final class ResolvedQuery extends Object
A BeanQuery after validation: the engine-neutral input to every engine hook.

Produced only by BeanQueryContext.resolve(BeanQuery) and BeanQuerySession.resolve(BeanQuery). Every column in it is allowed, every expression is parsed, depth-checked and type-checked, the limit is clamped, and counts() is never CountPolicy.IF_REQUESTED. Engines never see raw request strings.

Example:

// Validate without executing, e.g. to fail fast or to inspect what a request will do. ResolvedQuery q = context.resolve(BeanQuery.create().gt("age", 21).sortDesc("name").build()); if (q.filter() instanceof Filter.Leaf leaf) log.fine(leaf.column() + " (" + leaf.type() + "): " + leaf.expression()); boolean newestFirst = q.sort().get(0).descending();

The nested ResolvedQuery.SortKey type is covered by this example.

Since:
10.0.0
  • Method Details

    • filter

      public Filter filter()
      Returns:
      The resolved search tree, AND-ed and OR-ed across columns as the request's search expressed it; never null — an empty search resolves to an empty Filter.And, which matches every row.
    • sort

      Returns:
      The sort keys, most significant first (empty for source order).
    • view

      public List<String> view()
      Returns:
      The view columns; never empty (defaults to every allowed column in declaration order).
    • position

      public int position()
      Returns:
      The zero-based offset of the first row (never negative).
    • limit

      public Integer limit()
      Returns:
      The maximum number of rows, or null for all rows (only when maxLimit is unset).
    • counts

      public CountPolicy counts()
      Returns:
      The effective count policy: CountPolicy.NONE, CountPolicy.MATCHED or CountPolicy.BOTH.
    • toString

      public String toString()
      Overrides:
      toString in class Object