blob: 6e22168f837c975f0a763011169fe12bdf54f243 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.grouping.result;
/**
* This abstract class represents the id of a single group in the grouping result model. A subclass corresponding to the
* evaluation result of generating {@link com.yahoo.search.grouping.request.GroupingExpression} is contained in all
* {@link Group} objects. It is used by {@link com.yahoo.search.grouping.GroupingRequest} to identify its root result
* group, and by all client code for identifying groups.
* <p>
* The {@link #toString()} method of this class generates a URI-compatible string on the form
* "group:<typeName>:<subclassSpecific>".
*
* @author Simon Thoresen Hult
*/
public abstract class GroupId {
private final String type;
private final String image;
protected GroupId(String type, Object... args) {
this.type = type;
StringBuilder image = new StringBuilder("group:");
image.append(type);
for (Object arg : args) {
image.append(":").append(arg);
}
this.image = image.toString();
}
/** Returns the type name of this group id. This is the second part of the {@link #toString()} value of this. */
public String getTypeName() {
return type;
}
@Override
public String toString() {
return image;
}
}
|