이 콘텐츠는 선택한 언어로 제공되지 않습니다.
3.3.2. Specify an Intrinsic Group
Use an intrinsic group with the Grouping API if:
- the key class definition can be altered, that is if it is not part of an unmodifiable library.
- if the key class is not concerned with the determination of a key/value pair group.
Use the
@Group annotation in the relevant method to specify an intrinsic group. The group must always be a String, as illustrated in the example:
Example 3.2. Specifying an Intrinsic Group Example
class User {
...
String office;
...
public int hashCode()) {
// Defines the hash for the key, normally used to determine location
...
}
// Override the location by specifying a group, all keys in the same
// group end up with the same owner
@Group
String getOffice() {
return office;
}
}