io.getunleash.Constraint 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
The newest version!
package io.getunleash;
import io.getunleash.lang.Nullable;
import java.util.Collections;
import java.util.List;
public class Constraint {
private final String contextName;
private final Operator operator;
@Nullable private final List values;
@Nullable private final String value;
private final boolean inverted;
private final boolean caseInsensitive;
public Constraint(String contextName, Operator operator, List values) {
this(contextName, operator, null, values, false, false);
}
public Constraint(String contextName, Operator operator, String value) {
this(contextName, operator, value, Collections.emptyList(), false, false);
}
public Constraint(
String contextName, Operator operator, List values, boolean inverted) {
this(contextName, operator, null, values, inverted, false);
}
public Constraint(String contextName, Operator operator, String value, boolean inverted) {
this(contextName, operator, value, Collections.emptyList(), inverted, false);
}
public Constraint(
String contextName,
Operator operator,
List values,
boolean inverted,
boolean caseInsensitive) {
this(contextName, operator, null, values, inverted, caseInsensitive);
}
public Constraint(
String contextName,
Operator operator,
@Nullable String value,
@Nullable List values,
boolean inverted,
boolean caseInsensitive) {
this.contextName = contextName;
this.operator = operator;
this.values = values;
this.inverted = inverted;
this.caseInsensitive = caseInsensitive;
this.value = value;
}
public String getContextName() {
return contextName;
}
public Operator getOperator() {
return operator;
}
public List getValues() {
return values != null ? values : Collections.emptyList();
}
public @Nullable String getValue() {
return value;
}
public boolean isInverted() {
return inverted;
}
public boolean isCaseInsensitive() {
return caseInsensitive;
}
}