aboutsummaryrefslogtreecommitdiffstats
path: root/container-search/src/main/java/com/yahoo/search/grouping/request/ConstantValue.java
blob: d70922b0541819c2c22ad3001bc2e0247e5c864a (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
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.grouping.request;

/**
 * This class represents a constant value in a {@link GroupingExpression}. Because it does not operate on any input,
 * this expression type can be used at any input level (see {@link GroupingExpression#resolveLevel(int)}). All supported
 * data types are represented as subclasses of this.
 *
 * @author Simon Thoresen Hult
 * @author bratseth
 */
@SuppressWarnings("rawtypes")
public abstract class ConstantValue<T extends Comparable> extends GroupingExpression {

    private final T value;

    protected ConstantValue(String label, Integer level, T value) {
        super(asImage(value), label, level);
        this.value = value;
    }

    @Override
    public abstract ConstantValue copy();

    /** Returns the constant value of this */
    public T getValue() {
        return value;
    }

}