aboutsummaryrefslogtreecommitdiffstats
path: root/container-search/src/main/java/com/yahoo/search/grouping/result/ValueGroupId.java
blob: 72709c499191806aeac443029cd3202a06264bb8 (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
// Copyright Yahoo. 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 is used in {@link Group} instances where the identifying expression evaluated to a singe value.
 *
 * @author Simon Thoresen Hult
 */
public abstract class ValueGroupId<T> extends GroupId {

    private final T value;

    /**
     * Constructs a new instance of this class.
     *
     * @param type  the type of this id's value
     * @param value the identifying value
     */
    public ValueGroupId(String type, T value) {
        this(type, value, String.valueOf(value.toString()));
    }

    /**
     * Constructs a new instance of this class.
     *
     * @param type       the type of this id's value
     * @param value      the identifying value
     * @param valueImage the String representation of the <code>value</code> argument
     */
    public ValueGroupId(String type, T value, String valueImage) {
        super(type, valueImage);
        this.value = value;
    }

    /** Returns the identifying value. */
    public T getValue() {
        return value;
    }

}