Class CriteriaQueryImpl<T>

java.lang.Object
cz.cvut.kbss.jopa.model.CriteriaQueryImpl<T>
All Implemented Interfaces:
CriteriaQuery<T>

public class CriteriaQueryImpl<T> extends Object implements CriteriaQuery<T>
  • Field Details

  • Constructor Details

  • Method Details

    • from

      public <X> Root<X> from(Class<X> entityClass)
      Description copied from interface: CriteriaQuery
      Create and add a query root corresponding to the given entity class.
      Specified by:
      from in interface CriteriaQuery<T>
      Parameters:
      entityClass - the entity class
      Returns:
      query root corresponding to the given entity
    • from

      public <X> Root<X> from(EntityType<X> entity)
      Description copied from interface: CriteriaQuery
      Create and add a query root corresponding to the given entity type.
      Specified by:
      from in interface CriteriaQuery<T>
      Parameters:
      entity - metamodel entity representing the entity of type X
      Returns:
      query root corresponding to the given entity
    • select

      public CriteriaQuery<T> select(Selection<? extends T> selection)
      Description copied from interface: CriteriaQuery
      Specify the item that is to be returned in the query result. Replaces the previously specified selection(s), if any.
      Specified by:
      select in interface CriteriaQuery<T>
      Parameters:
      selection - - selection specifying the item that is to be returned in the query result
      Returns:
      the modified query
    • where

      public CriteriaQuery<T> where(Expression<Boolean> expression)
      Description copied from interface: CriteriaQuery
      Modify the query to restrict the query result according to the specified boolean expression. Replaces the previously added restriction(s), if any.
      Specified by:
      where in interface CriteriaQuery<T>
      Parameters:
      expression - - a simple or compound boolean expression
      Returns:
      the modified query
    • where

      public CriteriaQuery<T> where(Predicate... predicates)
      Description copied from interface: CriteriaQuery
      Modify the query to restrict the query result according to the conjunction of the specified restriction predicates. Replaces the previously added restriction(s), if any. If no restrictions are specified, any previously added restrictions are simply removed.
      Specified by:
      where in interface CriteriaQuery<T>
      Parameters:
      predicates - - zero or more restriction predicates
      Returns:
      the modified query
    • where

      public CriteriaQuery<T> where(List<Predicate> predicates)
      Description copied from interface: CriteriaQuery
      Modify the query to restrict the query result according to the conjunction of the specified restriction predicates. Replaces the previously added restriction(s), if any. If no restrictions are specified, any previously added restrictions are simply removed.
      Specified by:
      where in interface CriteriaQuery<T>
      Parameters:
      predicates - - list of predicates
      Returns:
      the modified query
    • getResultType

      public Class<T> getResultType()
      Specified by:
      getResultType in interface CriteriaQuery<T>
    • distinct

      public CriteriaQuery<T> distinct(boolean b)
      Description copied from interface: CriteriaQuery
      Specify whether duplicate query results will be eliminated. A true value will cause duplicates to be eliminated. A false value will cause duplicates to be retained. If distinct has not been specified, duplicate results must be retained.
      Specified by:
      distinct in interface CriteriaQuery<T>
      Parameters:
      b - - boolean value specifying whether duplicate results must be eliminated from the query result or whether they must be retained
      Returns:
      the modified query
    • distinct

      public CriteriaQuery<T> distinct()
      Description copied from interface: CriteriaQuery
      Specify that duplicates query results will be eliminated.
      Specified by:
      distinct in interface CriteriaQuery<T>
      Returns:
      the modified query
    • isDistinct

      public boolean isDistinct()
      Description copied from interface: CriteriaQuery
      Return whether duplicate query results must be eliminated or retained.
      Specified by:
      isDistinct in interface CriteriaQuery<T>
      Returns:
      boolean indicating whether duplicate query results must be eliminated
    • getSelection

      public Selection<T> getSelection()
      Description copied from interface: CriteriaQuery
      Return the selection of the query, or null if no selection has been set.
      Specified by:
      getSelection in interface CriteriaQuery<T>
      Returns:
      selection item
    • getRestriction

      public Predicate getRestriction()
      Description copied from interface: CriteriaQuery
      Return the predicate that corresponds to the where clause restriction(s), or null if no restrictions have been specified.
      Specified by:
      getRestriction in interface CriteriaQuery<T>
      Returns:
      where clause predicate
    • orderBy

      public CriteriaQuery<T> orderBy(List<Order> o)
      Description copied from interface: CriteriaQuery
      Specify the ordering expressions that are used to order the query results. Replaces the previous ordering expressions, if any. If no ordering expressions are specified, the previous ordering, if any, is simply removed, and results will be returned in no particular order. The left-to-right sequence of the ordering expressions determines the precedence, whereby the leftmost has highest precedence.
      Specified by:
      orderBy in interface CriteriaQuery<T>
      Parameters:
      o - list of zero or more ordering expressions
      Returns:
      the modified query
    • orderBy

      public CriteriaQuery<T> orderBy(Order... o)
      Description copied from interface: CriteriaQuery
      Specify the ordering expressions that are used to order the query results. Replaces the previous ordering expressions, if any. If no ordering expressions are specified, the previous ordering, if any, is simply removed, and results will be returned in no particular order. The left-to-right sequence of the ordering expressions determines the precedence, whereby the leftmost has highest precedence.
      Specified by:
      orderBy in interface CriteriaQuery<T>
      Parameters:
      o - zero or more ordering expressions
      Returns:
      the modified query
    • getOrderList

      public List<Order> getOrderList()
      Description copied from interface: CriteriaQuery
      Return the ordering expressions in order of precedence. Returns empty list if no ordering expressions have been specified.
      Specified by:
      getOrderList in interface CriteriaQuery<T>
      Returns:
      the list of ordering expressions
    • groupBy

      public CriteriaQuery<T> groupBy(Expression<?>... grouping)
      Description copied from interface: CriteriaQuery
      Specify the expressions that are used to form groups over the query results. Replaces the previous specified grouping expressions, if any. If no grouping expressions are specified, any previously added grouping expressions are simply removed.
      Specified by:
      groupBy in interface CriteriaQuery<T>
      Parameters:
      grouping - zero or more grouping expressions
      Returns:
      the modified query
    • groupBy

      public CriteriaQuery<T> groupBy(List<Expression<?>> grouping)
      Description copied from interface: CriteriaQuery
      Specify the expressions that are used to form groups over the query results. Replaces the previous specified grouping expressions, if any. If no grouping expressions are specified, any previously added grouping expressions are simply removed.
      Specified by:
      groupBy in interface CriteriaQuery<T>
      Parameters:
      grouping - list of zero or more grouping expressions
      Returns:
      the modified query
    • having

      public CriteriaQuery<T> having(Expression<Boolean> restriction)
      Description copied from interface: CriteriaQuery
      Specify a restriction over the groups of the query. Replaces the previous having restriction(s), if any.
      Specified by:
      having in interface CriteriaQuery<T>
      Parameters:
      restriction - a simple or compound boolean expression
      Returns:
      the modified query
    • having

      public CriteriaQuery<T> having(Predicate... restrictions)
      Description copied from interface: CriteriaQuery
      Specify restrictions over the groups of the query according the conjunction of the specified restriction predicates. Replaces the previously added having restriction(s), if any. If no restrictions are specified, any previously added restrictions are simply removed.
      Specified by:
      having in interface CriteriaQuery<T>
      Parameters:
      restrictions - zero or more restriction predicates
      Returns:
      the modified query
    • translateQuery

      public String translateQuery(CriteriaParameterFiller parameterFiller)
      Method translates criteria query to SOQL query and returns its string representation.
      Parameters:
      parameterFiller - Generator of parameter values in the query string
      Returns:
      string representation of SOQL query