Interface BlazeCriteriaBuilder

All Superinterfaces:
CriteriaBuilder

public interface BlazeCriteriaBuilder extends CriteriaBuilder
An extended version of CriteriaBuilder.
Since:
1.2.0
Author:
Christian Beikov
  • Method Details

    • isMapEmpty

      <C extends Map<?, ?>> Predicate isMapEmpty(Expression<C> map)
      Create a predicate that tests whether a map is empty.
      Type Parameters:
      C - map type
      Parameters:
      map - expression
      Returns:
      is-empty predicate
    • isMapNotEmpty

      <C extends Map<?, ?>> Predicate isMapNotEmpty(Expression<C> map)
      Create a predicate that tests whether a map is not empty.
      Type Parameters:
      C - map type
      Parameters:
      map - expression
      Returns:
      is-not-empty predicate
    • mapSize

      <C extends Map<?, ?>> Expression<Integer> mapSize(Expression<C> map)
      Create an expression that tests the size of a map.
      Type Parameters:
      C - map type
      Parameters:
      map - map
      Returns:
      size expression
    • mapSize

      <C extends Map<?, ?>> Expression<Integer> mapSize(C map)
      Create an expression that tests the size of a map.
      Type Parameters:
      C - map type
      Parameters:
      map - map
      Returns:
      size expression
    • asc

      BlazeOrder asc(Expression<?> x, boolean nullsFirst)
      Like CriteriaBuilder.asc(Expression) but allows to also specify the null precedence.
      Parameters:
      x - The expression used to define the ordering
      nullsFirst - True if nulls should be first, false otherwise
      Returns:
      ascending ordering corresponding to the expression
    • desc

      BlazeOrder desc(Expression<?> x, boolean nullsFirst)
      Like CriteriaBuilder.desc(Expression) but allows to also specify the null precedence.
      Parameters:
      x - The expression used to define the ordering
      nullsFirst - True if nulls should be first, false otherwise
      Returns:
      descending ordering corresponding to the expression
    • createCriteriaUpdate

      <T> BlazeCriteriaUpdate<T> createCriteriaUpdate(Class<T> targetEntity, String alias)
      Like createCriteriaUpdate(Class) but also sets the alias for the entity.
      Type Parameters:
      T - The type of the entity
      Parameters:
      targetEntity - target type for update operation
      alias - The alias for the entity
      Returns:
      the query object
    • createCriteriaDelete

      <T> BlazeCriteriaDelete<T> createCriteriaDelete(Class<T> targetEntity, String alias)
      Like createCriteriaDelete(Class) but also sets the alias for the entity.
      Type Parameters:
      T - The type of the entity
      Parameters:
      targetEntity - target type for delete operation
      alias - The alias for the entity
      Returns:
      the query object
    • asc

      Specified by:
      asc in interface CriteriaBuilder
    • desc

      BlazeOrder desc(Expression<?> x)
      Specified by:
      desc in interface CriteriaBuilder
    • createQuery

      BlazeCriteriaQuery<Object> createQuery()
      Specified by:
      createQuery in interface CriteriaBuilder
    • createQuery

      <T> BlazeCriteriaQuery<T> createQuery(Class<T> resultClass)
      Specified by:
      createQuery in interface CriteriaBuilder
    • createTupleQuery

      BlazeCriteriaQuery<Tuple> createTupleQuery()
      Specified by:
      createTupleQuery in interface CriteriaBuilder
    • createCriteriaUpdate

      <T> BlazeCriteriaUpdate<T> createCriteriaUpdate(Class<T> targetEntity)
      Create a query object to perform a bulk update operation.
      Type Parameters:
      T - The type of the entity
      Parameters:
      targetEntity - target type for update operation
      Returns:
      the query object
    • createCriteriaDelete

      <T> BlazeCriteriaDelete<T> createCriteriaDelete(Class<T> targetEntity)
      Create a query object to perform a bulk delete operation.
      Type Parameters:
      T - The type of the entity
      Parameters:
      targetEntity - target type for delete operation
      Returns:
      the query object
    • treat

      <X, T, V extends T> BlazeJoin<X,V> treat(Join<X,T> join, Class<V> type)
      Downcast Join object to the specified type.
      Type Parameters:
      X - The source type
      T - The type of the joined relation
      V - The target treat type
      Parameters:
      join - Join object
      type - type to be downcast to
      Returns:
      Join object of the specified type
    • treat

      <X, T, E extends T> BlazeCollectionJoin<X,E> treat(CollectionJoin<X,T> join, Class<E> type)
      Downcast CollectionJoin object to the specified type.
      Type Parameters:
      X - The source type
      T - The type of the joined relation
      E - The target treat type
      Parameters:
      join - CollectionJoin object
      type - type to be downcast to
      Returns:
      CollectionJoin object of the specified type
    • treat

      <X, T, E extends T> BlazeSetJoin<X,E> treat(SetJoin<X,T> join, Class<E> type)
      Downcast SetJoin object to the specified type.
      Type Parameters:
      X - The source type
      T - The type of the joined relation
      E - The target treat type
      Parameters:
      join - SetJoin object
      type - type to be downcast to
      Returns:
      SetJoin object of the specified type
    • treat

      <X, T, E extends T> BlazeListJoin<X,E> treat(ListJoin<X,T> join, Class<E> type)
      Downcast ListJoin object to the specified type.
      Type Parameters:
      X - The source type
      T - The type of the joined relation
      E - The target treat type
      Parameters:
      join - ListJoin object
      type - type to be downcast to
      Returns:
      ListJoin object of the specified type
    • treat

      <X, K, T, V extends T> BlazeMapJoin<X,K,V> treat(MapJoin<X,K,T> join, Class<V> type)
      Downcast MapJoin object to the specified type.
      Type Parameters:
      X - The source type
      T - The type of the joined relation
      K - The key type of the joined relation
      V - The target treat type
      Parameters:
      join - MapJoin object
      type - type to be downcast to
      Returns:
      MapJoin object of the specified type
    • treat

      <X, T extends X> BlazePath<T> treat(Path<X> path, Class<T> type)
      Downcast Path object to the specified type.
      Type Parameters:
      X - The path type
      T - The target treat type
      Parameters:
      path - path
      type - type to be downcast to
      Returns:
      Path object of the specified type
    • treat

      <X, T extends X> BlazeRoot<T> treat(Root<X> root, Class<T> type)
      Downcast Root object to the specified type.
      Type Parameters:
      X - The root type
      T - The target treat type
      Parameters:
      root - root
      type - type to be downcast to
      Returns:
      Path object of the specified type
    • treat

      <X, T, V extends T> BlazeJoin<X,V> treat(BlazeJoin<X,T> join, Class<V> type)
      Downcast Join object to the specified type.
      Type Parameters:
      X - The source type
      T - The type of the joined relation
      V - The target treat type
      Parameters:
      join - Join object
      type - type to be downcast to
      Returns:
      Join object of the specified type
    • treat

      <X, T, E extends T> BlazeCollectionJoin<X,E> treat(BlazeCollectionJoin<X,T> join, Class<E> type)
      Downcast CollectionJoin object to the specified type.
      Type Parameters:
      X - The source type
      T - The type of the joined relation
      E - The target treat type
      Parameters:
      join - CollectionJoin object
      type - type to be downcast to
      Returns:
      CollectionJoin object of the specified type
    • treat

      <X, T, E extends T> BlazeSetJoin<X,E> treat(BlazeSetJoin<X,T> join, Class<E> type)
      Downcast SetJoin object to the specified type.
      Type Parameters:
      X - The source type
      T - The type of the joined relation
      E - The target treat type
      Parameters:
      join - SetJoin object
      type - type to be downcast to
      Returns:
      SetJoin object of the specified type
    • treat

      <X, T, E extends T> BlazeListJoin<X,E> treat(BlazeListJoin<X,T> join, Class<E> type)
      Downcast ListJoin object to the specified type.
      Type Parameters:
      X - The source type
      T - The type of the joined relation
      E - The target treat type
      Parameters:
      join - ListJoin object
      type - type to be downcast to
      Returns:
      ListJoin object of the specified type
    • treat

      <X, K, T, V extends T> BlazeMapJoin<X,K,V> treat(BlazeMapJoin<X,K,T> join, Class<V> type)
      Downcast MapJoin object to the specified type.
      Type Parameters:
      X - The source type
      T - The type of the joined relation
      K - The key type of the joined relation
      V - The target treat type
      Parameters:
      join - MapJoin object
      type - type to be downcast to
      Returns:
      MapJoin object of the specified type
    • treat

      <X, T extends X> BlazePath<T> treat(BlazePath<X> path, Class<T> type)
      Downcast Path object to the specified type.
      Type Parameters:
      X - The path type
      T - The target treat type
      Parameters:
      path - path
      type - type to be downcast to
      Returns:
      Path object of the specified type
    • treat

      <X, T extends X> BlazeRoot<T> treat(BlazeRoot<X> root, Class<T> type)
      Downcast Root object to the specified type.
      Type Parameters:
      X - The root type
      T - The target treat type
      Parameters:
      root - root
      type - type to be downcast to
      Returns:
      Path object of the specified type
    • window

      BlazeWindow window()
      Returns a new window to be used with window functions.
      Returns:
      the new window
    • function

      <T> BlazeFunctionExpression<T> function(String name, Class<T> type, Expression<?>... args)
      Creates a function expression for a function with the given name, result type and arguments.
      Specified by:
      function in interface CriteriaBuilder
      Type Parameters:
      T - the result type
      Parameters:
      name - the name of the function
      type - the result type of function
      args - the arguments for the function
      Returns:
      the function expression
    • windowFunction

      <T> BlazeWindowFunctionExpression<T> windowFunction(String name, Class<T> type, Expression<?>... args)
      Creates a window function expression for a function with the given name, result type and arguments.
      Type Parameters:
      T - the result type
      Parameters:
      name - the name of the function
      type - the result type of function
      args - the arguments for the function
      Returns:
      the window function expression
    • windowDistinctFunction

      <T> BlazeWindowFunctionExpression<T> windowDistinctFunction(String name, Class<T> type, Expression<?>... args)
      Creates a window function expression for a function with the given name, result type and arguments aggregating only distinct elements.
      Type Parameters:
      T - the result type
      Parameters:
      name - the name of the function
      type - the result type of function
      args - the arguments for the function
      Returns:
      the window function expression
    • aggregateFunction

      <T> BlazeAggregateFunctionExpression<T> aggregateFunction(String name, Class<T> type, Expression<?>... args)
      Creates an aggregate function expression for a function with the given name, result type and arguments.
      Type Parameters:
      T - the result type
      Parameters:
      name - the name of the function
      type - the result type of function
      args - the arguments for the function
      Returns:
      the aggregate function expression
    • aggregateDistinctFunction

      <T> BlazeAggregateFunctionExpression<T> aggregateDistinctFunction(String name, Class<T> type, Expression<?>... args)
      Creates an aggregate function expression for a function with the given name, result type and arguments aggregating only distinct elements.
      Type Parameters:
      T - the result type
      Parameters:
      name - the name of the function
      type - the result type of function
      args - the arguments for the function
      Returns:
      the aggregate function expression
    • orderedSetAggregateFunction

      <T> BlazeOrderedSetAggregateFunctionExpression<T> orderedSetAggregateFunction(String name, Class<T> type, Expression<?>... args)
      Creates an ordered set-aggregate function expression for a function with the given name, result type and arguments.
      Type Parameters:
      T - the result type
      Parameters:
      name - the name of the function
      type - the result type of function
      args - the arguments for the function
      Returns:
      the ordered set-aggregate function expression
    • orderedSetAggregateDistinctFunction

      <T> BlazeOrderedSetAggregateFunctionExpression<T> orderedSetAggregateDistinctFunction(String name, Class<T> type, Expression<?>... args)
      Creates an ordered set-aggregate function expression for a function with the given name, result type and arguments aggregating only distinct elements.
      Type Parameters:
      T - the result type
      Parameters:
      name - the name of the function
      type - the result type of function
      args - the arguments for the function
      Returns:
      the ordered set-aggregate function expression
    • avg

      Creates an AVG aggregate function expression.
      Specified by:
      avg in interface CriteriaBuilder
      Type Parameters:
      N - The number type
      Parameters:
      x - the argument to aggregate
      Returns:
      the aggregate function expression
    • sum

      Creates a SUM aggregate function expression.
      Specified by:
      sum in interface CriteriaBuilder
      Type Parameters:
      N - The number type
      Parameters:
      x - the argument to aggregate
      Returns:
      the aggregate function expression
    • sumAsLong

      Creates a SUM aggregate function expression that returns a long value.
      Specified by:
      sumAsLong in interface CriteriaBuilder
      Parameters:
      x - the argument to aggregate
      Returns:
      the aggregate function expression
    • sumAsDouble

      Creates a SUM aggregate function expression that returns a double value.
      Specified by:
      sumAsDouble in interface CriteriaBuilder
      Parameters:
      x - the argument to aggregate
      Returns:
      the aggregate function expression
    • max

      Creates a MAX aggregate function expression.
      Specified by:
      max in interface CriteriaBuilder
      Type Parameters:
      N - The number type
      Parameters:
      x - the argument to aggregate
      Returns:
      the aggregate function expression
    • min

      Creates a MIN aggregate function expression.
      Specified by:
      min in interface CriteriaBuilder
      Type Parameters:
      N - The number type
      Parameters:
      x - the argument to aggregate
      Returns:
      the aggregate function expression
    • greatest

      <X extends Comparable<? super X>> BlazeAggregateFunctionExpression<X> greatest(Expression<X> x)
      Creates a MAX aggregate function expression.
      Specified by:
      greatest in interface CriteriaBuilder
      Type Parameters:
      X - The argument type
      Parameters:
      x - the argument to aggregate
      Returns:
      the aggregate function expression
    • least

      <X extends Comparable<? super X>> BlazeAggregateFunctionExpression<X> least(Expression<X> x)
      Creates a MIN aggregate function expression.
      Specified by:
      least in interface CriteriaBuilder
      Type Parameters:
      X - The argument type
      Parameters:
      x - the argument to aggregate
      Returns:
      the aggregate function expression
    • count

      Creates a COUNT aggregate function expression.
      Specified by:
      count in interface CriteriaBuilder
      Parameters:
      x - the argument to use for determining whether to count
      Returns:
      the aggregate function expression
    • countDistinct

      Creates a COUNT aggregate function expression which only counts distinct elements.
      Specified by:
      countDistinct in interface CriteriaBuilder
      Parameters:
      x - the argument to use for determining whether to count
      Returns:
      the aggregate function expression
    • rowNumber

      Creates a ROW_NUMBER window function expression.
      Returns:
      the window function expression
    • rank

      Creates a RANK window function expression.
      Parameters:
      expression - the expression for which to apply the window function to
      Returns:
      the window function expression
    • denseRank

      Creates a DENSE_RANK window function expression.
      Parameters:
      expression - the expression for which to apply the window function to
      Returns:
      the window function expression
    • percentRank

      BlazeWindowFunctionExpression<Double> percentRank(Expression<?> expression)
      Creates a PERCENT_RANK window function expression.
      Parameters:
      expression - the expression for which to apply the window function to
      Returns:
      the window function expression
    • cumeDist

      Creates a CUME_DIST window function expression.
      Parameters:
      expression - the expression for which to apply the window function to
      Returns:
      the window function expression
    • ntile

      Creates a NTILE window function expression.
      Parameters:
      expression - the expression for which to apply the window function to
      Returns:
      the window function expression
    • lead

      <X> BlazeWindowFunctionExpression<X> lead(Expression<X> expression)
      Creates a LEAD window function expression.
      Type Parameters:
      X - The expression type
      Parameters:
      expression - the expression for which to apply the window function to
      Returns:
      the window function expression
    • lag

      <X> BlazeWindowFunctionExpression<X> lag(Expression<X> expression)
      Creates a LAG window function expression.
      Type Parameters:
      X - The expression type
      Parameters:
      expression - the expression for which to apply the window function to
      Returns:
      the window function expression
    • firstValue

      <X> BlazeWindowFunctionExpression<X> firstValue(Expression<X> expression)
      Creates a FIRST_VALUE window function expression.
      Type Parameters:
      X - The expression type
      Parameters:
      expression - the expression for which to apply the window function to
      Returns:
      the window function expression
    • lastValue

      <X> BlazeWindowFunctionExpression<X> lastValue(Expression<X> expression)
      Creates a LAST_VALUE window function expression.
      Type Parameters:
      X - The expression type
      Parameters:
      expression - the expression for which to apply the window function to
      Returns:
      the window function expression
    • nthValue

      <X> BlazeWindowFunctionExpression<X> nthValue(Expression<X> expression, Expression<Integer> index)
      Creates a NTH_VALUE window function expression.
      Type Parameters:
      X - The expression type
      Parameters:
      expression - the expression for which to apply the window function to
      index - the index of the value relative to the frame start
      Returns:
      the window function expression
    • percentileContWithinGroup

      <X> BlazeOrderedSetAggregateFunctionExpression<X> percentileContWithinGroup(Expression<Double> fraction, Expression<X> group, boolean ascending, boolean nullsFirst)
      Creates a PERCENTILE_CONT ordered set-aggregate function expression.
      Type Parameters:
      X - The expression type
      Parameters:
      fraction - the fraction of the ordering for which to return a value for
      group - the group within which to determine the percentile
      ascending - Whether to sort by group ascending or descending
      nullsFirst - Whether to sort nulls of the group first or last
      Returns:
      the ordered set-aggregate function expression
    • percentileDiscWithinGroup

      <X> BlazeOrderedSetAggregateFunctionExpression<X> percentileDiscWithinGroup(Expression<Double> fraction, Expression<X> group, boolean ascending, boolean nullsFirst)
      Creates a PERCENTILE_DISC ordered set-aggregate function expression.
      Type Parameters:
      X - The expression type
      Parameters:
      fraction - the fraction of the ordering for which to return a value for
      group - the group within which to determine the percentile
      ascending - Whether to sort by group ascending or descending
      nullsFirst - Whether to sort nulls of the group first or last
      Returns:
      the ordered set-aggregate function expression
    • modeWithinGroup

      <X> BlazeOrderedSetAggregateFunctionExpression<X> modeWithinGroup(Expression<X> group)
      Creates a MODE ordered set-aggregate function expression.
      Type Parameters:
      X - The expression type
      Parameters:
      group - the group within which to find the mode
      Returns:
      the ordered set-aggregate function expression
    • listagg

      Creates a LISTAGG ordered set-aggregate function expression.
      Parameters:
      expression - the argument to list aggregate
      separator - the separator to put between elements in the aggregation
      Returns:
      the ordered set-aggregate function expression
    • listaggDistinct

      Creates a LISTAGG ordered set-aggregate function expression which only aggregates distinct elements.
      Parameters:
      expression - the argument to list aggregate
      separator - the separator to put between elements in the aggregation
      Returns:
      the ordered set-aggregate function expression