Interface GroupResult<K,T>
- Type Parameters:
K- the type of the group keyT- the type of the grouped elements
- All Superinterfaces:
Queryable<T>
Represents a group result from a
groupby...into clause.
Extends Queryable to provide aggregate and query methods
on the group's elements, with a key property for accessing
the group key.- Since:
- 6.0.0
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.groovy.ginq.provider.collection.runtime.Queryable
Queryable.Order<T,U extends Comparable<? super U>> -
Field Summary
Fields inherited from interface org.apache.groovy.ginq.provider.collection.runtime.Queryable
EMPTY_QUERYABLE, NULL -
Method Summary
Modifier and TypeMethodDescriptionReturns a named component of the group key.default ObjectSubscript operator for accessing named key components.getKey()Returns the group key.static <K,T> GroupResult<K, T> Factory method to create aGroupResultinstance.Methods inherited from interface org.apache.groovy.ginq.provider.collection.runtime.Queryable
agg, avg, count, count, crossJoin, distinct, exists, fullHashJoin, fullJoin, groupBy, groupBy, groupByInto, groupByInto, innerHashJoin, innerJoin, intersect, leftHashJoin, leftJoin, limit, limit, list, max, median, min, minus, orderBy, orderBy, over, rightHashJoin, rightJoin, select, size, stdev, stdevp, stream, sum, toList, union, unionAll, var, varp, where
-
Method Details
-
getKey
K getKey()Returns the group key. For single-key groupby, this is the raw key value. For multi-key groupby, this is aNamedRecordwith named access.- Returns:
- the group key
-
get
Returns a named component of the group key. Enablesg.nameproperty-style access andg.get("name")calls. For multi-key groupby, looks up the named component in the key record.- Parameters:
name- the key component name (fromasalias in groupby)- Returns:
- the value of the named key component
- Throws:
UnsupportedOperationException- if this is a single-key group without aliases
-
getAt
Subscript operator for accessing named key components. Enablesg["name"]syntax.- Parameters:
name- the key component name- Returns:
- the value of the named key component
-
of
Factory method to create aGroupResultinstance.- Type Parameters:
K- the type of the group keyT- the type of the grouped elements- Parameters:
key- the group keygroup- the grouped elements as a Queryable- Returns:
- a new GroupResult
-