Class HavingExpression<T,​R>

  • Type Parameters:
    T - Input parameter type
    R - Return parameter type
    All Implemented Interfaces:
    java.util.function.Function<T,​R>, java.util.function.Predicate<T>, Expression<T,​R>, ExpressionNode<T,​R>

    public class HavingExpression<T,​R>
    extends AbstractExpressionNode<T,​R>
    implements java.util.function.Predicate<T>
    Contains expression for evaluation of having clause predicate
    • Constructor Detail

      • HavingExpression

        public HavingExpression​(SelectExpression<T,​R> selectExpression,
                                ExpressionNode<T,​R> expression)
        Constructor initializes children expression list
        Parameters:
        selectExpression - Select expression
        expression - Having expression
    • Method Detail

      • apply

        public R apply​(T value)
        Evaluates an object against having clause
        Specified by:
        apply in interface Expression<T,​R>
        Specified by:
        apply in interface java.util.function.Function<T,​R>
        Parameters:
        value - Object to handle
        Returns:
        Evaluation result
      • test

        public boolean test​(T value)
        Evaluates an object against having clause
        Specified by:
        test in interface java.util.function.Predicate<T>
        Parameters:
        value - Object to handle
        Returns:
        Evaluation result
      • applyAggregation

        public <A> void applyAggregation​(SelectExpression<T,​R> selectExpression,
                                         java.util.List<T> items)
        Prepares boolean mask in form of a map having same structure as actual aggregation result, but containing boolean values instead of actual values. Later this boolean mask is applied to the aggregation result to filter it in accordance with the having predicate.
        Type Parameters:
        A - Collector accumulation type
        Parameters:
        selectExpression - Select expression
        items - List of objects to be aggregated
      • filter

        public void filter​(java.util.Map<java.lang.String,​R> result)
        Filters aggregation result in accordance with the having predicate
        Parameters:
        result - Map with aggregation result