io.getunleash.ActivationStrategy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of unleash-client-java Show documentation
Show all versions of unleash-client-java Show documentation
A client library for Unleash
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;
}
}