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

io.getunleash.ActivationStrategy Maven / Gradle / Ivy

The newest version!
package io.getunleash;

import io.getunleash.lang.Nullable;
import io.getunleash.variant.VariantDefinition;
import java.util.*;
import javax.annotation.Nonnull;

public final class ActivationStrategy {
    private final String name;
    private final Map parameters;
    private final List constraints;
    private final List segments;
    private final List variants;

    public ActivationStrategy(String name, @Nullable Map parameters) {
        this(
                name,
                parameters,
                Collections.emptyList(),
                Collections.emptyList(),
                Collections.emptyList());
    }

    public ActivationStrategy(
            String name,
            @Nullable Map parameters,
            List constraints,
            List segments,
            List variants) {
        this.name = name;
        this.parameters = Optional.ofNullable(parameters).orElseGet(Collections::emptyMap);
        this.constraints = Optional.ofNullable(constraints).orElseGet(Collections::emptyList);
        this.segments = Optional.ofNullable(segments).orElseGet(Collections::emptyList);
        this.variants = Optional.ofNullable(variants).orElseGet(Collections::emptyList);
    }

    public String getName() {
        return name;
    }

    public List getSegments() {
        return segments;
    }

    public Map getParameters() {
        return parameters;
    }

    public List getConstraints() {
        return constraints;
    }

    @Nonnull
    public List getVariants() {

        return variants;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy