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

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.BooleanNode;

/**
 * @author hakonhall
 */
public class UnboundBooleanFlag extends UnboundFlagImpl<Boolean, BooleanFlag, UnboundBooleanFlag> {
    public UnboundBooleanFlag(FlagId id) {
        this(id, false);
    }

    public UnboundBooleanFlag(FlagId id, boolean defaultValue) {
        this(id, defaultValue, new FetchVector());
    }

    public UnboundBooleanFlag(FlagId id, boolean defaultValue, FetchVector defaultFetchVector) {
        super(id, defaultValue, defaultFetchVector,
                new SimpleFlagSerializer<>(BooleanNode::valueOf, JsonNode::isBoolean, JsonNode::asBoolean),
                UnboundBooleanFlag::new, BooleanFlag::new);
    }
}