aboutsummaryrefslogtreecommitdiffstats
path: root/container-search/src/main/java/com/yahoo/search/grouping/result/ValueGroupId.java
blob: a76af885180d9ae5f4243cc6544c0039bbc49006 (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
42
43
44
45
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.grouping.result;

import static com.yahoo.text.Lowercase.toLowerCase;

/**
 * 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.
     *
     * @return The value.
     */
    public T getValue() {
        return value;
    }
}