aboutsummaryrefslogtreecommitdiffstats
path: root/flags/src/main/java/com/yahoo/vespa/flags/UnboundFlag.java
blob: d2d643e79b2bd98d4bfe566ef133eaca98f07fb2 (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.flags;

/**
 * Interface of an unbound flag.
 *
 * @param <T> Type of boxed value, e.g. Integer
 * @param <F> Type of flag, e.g. IntFlag
 * @param <U> Type of unbound flag, e.g. UnboundIntFlag
 *
 * @author hakonhall
 */
public interface UnboundFlag<T, F extends Flag<T, F>, U extends UnboundFlag<T, F, U>> {
    /** The flag ID. */
    FlagId id();

    /** Returns the flag serializer. */
    FlagSerializer<T> serializer();

    /** Returns a clone of the unbound flag, but with the dimension set accordingly. */
    U with(FetchVector.Dimension dimension, String dimensionValue);

    /** Binds to a flag source, returning a (bound) flag. */
    F bindTo(FlagSource source);

    /** Returns the default value of the flag */
    T defaultValue();
}