cloud.prefab.client.config.Match Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of prefab-cloud-java Show documentation
Show all versions of prefab-cloud-java Show documentation
API Client for https://prefab.cloud: rate limits, feature flags and semaphores as a service
The newest version!
package cloud.prefab.client.config;
import cloud.prefab.domain.Prefab;
import com.google.common.base.MoreObjects;
import java.util.List;
public class Match {
private final Prefab.ConfigValue configValue;
private final ConfigElement configElement;
private final List evaluatedCriterion;
public Match(
Prefab.ConfigValue configValue,
ConfigElement configElement,
List evaluatedCriterion
) {
this.configValue = configValue;
this.configElement = configElement;
this.evaluatedCriterion = evaluatedCriterion;
}
public Prefab.ConfigValue getConfigValue() {
return configValue;
}
public String getReason() {
StringBuilder sb = new StringBuilder();
evaluatedCriterion.forEach(ec -> {
sb.append(ec.getCriterion().getPropertyName());
sb.append(":");
sb.append(ec.getCriterion().getOperator());
});
return sb.toString();
}
public List getEvaluatedCriterion() {
return evaluatedCriterion;
}
@Override
public String toString() {
return MoreObjects
.toStringHelper(this)
.add("configElement", configElement)
.add("configValue", configValue)
.add("evaluatedCriterion", evaluatedCriterion)
.toString();
}
}