no.finn.unleash.variant.VariantDefinition 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 no.finn.unleash.variant;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import no.finn.unleash.Variant;
public class VariantDefinition {
private final String name;
private final int weight;
private final Payload payload;
private final List overrides;
public VariantDefinition(String name, int weight, Payload payload, List overrides) {
this.name = name;
this.weight = weight;
this.payload = payload;
this.overrides = overrides;
}
VariantDefinition(String name, int weight) {
this(name, weight, null, Collections.emptyList());
}
public String getName() {
return name;
}
public int getWeight() {
return weight;
}
public Payload getPayload() {
return payload;
}
List getOverrides() {
if(overrides == null) {
return Collections.emptyList();
} else {
return overrides;
}
}
Variant toVariant() {
return new Variant(name, payload, true);
}
}