Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.
3.3.3. Specify an Extrinsic Group
Specify an extrinsic group for the Grouping API if:
- the key class definition cannot be altered, that is if it is part of an unmodifiable library.
- if the key class is concerned with the determination of a key/value pair group.
An extrinsic group is specified using an implementation of the
Grouper interface. This interface uses the computeGroup method to return the group.
In the process of specifying an extrinsic group, the
Grouper interface acts as an interceptor by passing the computed value to computeGroup. If the @Group annotation is used, the group using it is passed to the first Grouper. As a result, using an intrinsic group provides even greater control.
Example 3.3. Specifying an Extrinsic Group Example
The following is an example that consists of a simple
Grouper that uses the key class to extract the group from a key using a pattern. Any group information specified on the key class is ignored in such a situation.