-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFeatureToggleEvaluation.java
More file actions
55 lines (44 loc) · 1.67 KB
/
FeatureToggleEvaluation.java
File metadata and controls
55 lines (44 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package com.octopus.openfeature.provider;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
import java.util.Optional;
class FeatureToggleEvaluation {
private final String slug;
private final boolean isEnabled;
private final String evaluationKey;
private final List<Segment> segments;
private final Integer clientRolloutPercentage;
@JsonCreator(mode = JsonCreator.Mode.PROPERTIES)
FeatureToggleEvaluation(
@JsonProperty(value = "slug", required = true) String slug,
@JsonProperty(value = "isEnabled", required = true) boolean isEnabled,
@JsonProperty("evaluationKey") String evaluationKey,
@JsonProperty("segments") List<Segment> segments,
@JsonProperty("clientRolloutPercentage") Integer clientRolloutPercentage
) {
this.slug = slug;
this.isEnabled = isEnabled;
this.evaluationKey = evaluationKey;
this.segments = segments == null ? null : List.copyOf(segments);
this.clientRolloutPercentage = clientRolloutPercentage;
}
public String getSlug() {
return slug;
}
public boolean isEnabled() {
return isEnabled;
}
public Optional<String> getEvaluationKey() {
return Optional.ofNullable(evaluationKey);
}
public Optional<List<Segment>> getSegments() {
return Optional.ofNullable(segments);
}
public boolean hasSegments() {
return segments != null && !segments.isEmpty();
}
public Optional<Integer> getClientRolloutPercentage() {
return Optional.ofNullable(clientRolloutPercentage);
}
}