All Downloads are FREE. Search and download functionalities are using the official Maven repository.

no.finn.unleash.FeatureToggle Maven / Gradle / Ivy

There is a newer version: 4.4.1
Show newest version
package no.finn.unleash;

import java.util.Collections;
import java.util.List;

import no.finn.unleash.variant.VariantDefinition;

import static java.util.Collections.emptyList;

public final class FeatureToggle {
    private final String name;
    private final boolean enabled;
    private final List strategies;
    private final List variants;

    public FeatureToggle(String name, boolean enabled, List strategies) {
        this(name, enabled, strategies, emptyList());
    }

    public FeatureToggle(String name, boolean enabled, List strategies, List variants) {
        this.name = name;
        this.enabled = enabled;
        this.strategies = strategies;
        this.variants = variants;
    }

    public String getName() {
        return name;
    }

    public boolean isEnabled() {
        return enabled;
    }

    public List getStrategies() {
        return this.strategies;
    }

    public List getVariants() {
        if(variants == null) {
            return Collections.emptyList();
        } else {
            return variants;
        }
    }

    @Override
    public String toString() {
        return "FeatureToggle{" +
                "name='" + name + '\'' +
                ", enabled=" + enabled +
                ", strategies='" + strategies + '\'' +
                ", variants='" + variants + '\'' +
                '}';
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy