Class DocumentQuery<T>

java.lang.Object
com.codename1.backend.document.DocumentQuery<T>
All Implemented Interfaces:
Query<T>

public final class DocumentQuery<T> extends Object implements Query<T>
A Query over a document collection. Comparisons, LIKE, IN, null tests, one sort field and paging are supported; joins, fetches and element tests throw UnsupportedOperationException, because a document store has no join.
  • Method Details

    • join

      public Query<T> join(String path)
      Description copied from interface: Query
      Adds an inner join on a relationship path.
      Specified by:
      join in interface Query<T>
      Parameters:
      path - Java relationship path
      Returns:
      this query
    • leftJoin

      public Query<T> leftJoin(String path)
      Description copied from interface: Query
      Adds a left join before the path is used in predicates.
      Specified by:
      leftJoin in interface Query<T>
      Parameters:
      path - Java relationship path
      Returns:
      this query
    • fetch

      public Query<T> fetch(String field)
      Description copied from interface: Query
      Initializes a direct relationship for returned entities, overriding lazy mapping.
      Specified by:
      fetch in interface Query<T>
      Parameters:
      field - Java relationship name
      Returns:
      this query
    • containsElement

      public Query<T> containsElement(String field, Object value)
      Description copied from interface: Query
      Adds a scalar collection membership predicate without loading the collection.
      Specified by:
      containsElement in interface Query<T>
      Parameters:
      field - Java element-collection name
      value - element to match; null matches SQL NULL
      Returns:
      this query
    • eq

      public Query<T> eq(String field, Object value)
      Description copied from interface: Query
      Adds an equality predicate; null matches SQL NULL.
      Specified by:
      eq in interface Query<T>
      Parameters:
      field - Java attribute name or joined path
      value - bound comparison value
      Returns:
      this query
    • ne

      public Query<T> ne(String field, Object value)
      Description copied from interface: Query
      Adds an inequality predicate; null matches SQL IS NOT NULL.
      Specified by:
      ne in interface Query<T>
      Parameters:
      field - Java attribute name or joined path
      value - bound comparison value
      Returns:
      this query
    • gt

      public Query<T> gt(String field, Object value)
      Description copied from interface: Query
      Adds a greater-than predicate.
      Specified by:
      gt in interface Query<T>
      Parameters:
      field - Java attribute name or joined path
      value - bound comparison value
      Returns:
      this query
    • ge

      public Query<T> ge(String field, Object value)
      Description copied from interface: Query
      Adds a greater-than-or-equal predicate.
      Specified by:
      ge in interface Query<T>
      Parameters:
      field - Java attribute name or joined path
      value - bound comparison value
      Returns:
      this query
    • lt

      public Query<T> lt(String field, Object value)
      Description copied from interface: Query
      Adds a less-than predicate.
      Specified by:
      lt in interface Query<T>
      Parameters:
      field - Java attribute name or joined path
      value - bound comparison value
      Returns:
      this query
    • le

      public Query<T> le(String field, Object value)
      Description copied from interface: Query
      Adds a less-than-or-equal predicate.
      Specified by:
      le in interface Query<T>
      Parameters:
      field - Java attribute name or joined path
      value - bound comparison value
      Returns:
      this query
    • like

      public Query<T> like(String field, String pattern)
      Description copied from interface: Query
      Adds a SQL LIKE predicate.
      Specified by:
      like in interface Query<T>
      Parameters:
      field - Java string attribute name or joined path
      pattern - bound SQL pattern; percent and underscore are wildcards
      Returns:
      this query
    • isNull

      public Query<T> isNull(String field)
      Description copied from interface: Query
      Adds an IS NULL predicate.
      Specified by:
      isNull in interface Query<T>
      Parameters:
      field - Java attribute name or joined path
      Returns:
      this query
    • isNotNull

      public Query<T> isNotNull(String field)
      Description copied from interface: Query
      Adds an IS NOT NULL predicate.
      Specified by:
      isNotNull in interface Query<T>
      Parameters:
      field - Java attribute name or joined path
      Returns:
      this query
    • in

      public Query<T> in(String field, Object... values)
      Description copied from interface: Query
      Adds an IN predicate; an empty array matches no rows.
      Specified by:
      in in interface Query<T>
      Parameters:
      field - Java attribute name or joined path
      values - values bound as parameters
      Returns:
      this query
    • orderBy

      public Query<T> orderBy(String field, boolean ascending)
      Description copied from interface: Query
      Appends an ordering term. Collection joins require ordering by root fields.
      Specified by:
      orderBy in interface Query<T>
      Parameters:
      field - Java attribute name or joined path
      ascending - true for ascending order, false for descending
      Returns:
      this query
    • limit

      public Query<T> limit(int value)
      Description copied from interface: Query
      Sets the maximum number of results; zero returns no rows.
      Specified by:
      limit in interface Query<T>
      Parameters:
      value - nonnegative result limit
      Returns:
      this query
    • offset

      public Query<T> offset(int value)
      Description copied from interface: Query
      Sets the number of leading results to skip.
      Specified by:
      offset in interface Query<T>
      Parameters:
      value - nonnegative result offset
      Returns:
      this query
    • list

      public List<T> list()
      Description copied from interface: Query
      Executes the query, applying pagination and fetch requests.
      Specified by:
      list in interface Query<T>
      Returns:
      managed entities matching all predicates
    • first

      public T first()
      Description copied from interface: Query
      Executes the query for at most one result, respecting the offset.
      Specified by:
      first in interface Query<T>
      Returns:
      the first managed entity, or null if no match or the limit is zero
    • count

      public long count()
      Description copied from interface: Query
      Counts matching root entities, ignoring ordering and pagination.
      Specified by:
      count in interface Query<T>
      Returns:
      number of distinct matching entities