forked from open-feature/java-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathImmutableTrackingEventDetails.java
53 lines (41 loc) · 1.59 KB
/
ImmutableTrackingEventDetails.java
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
package dev.openfeature.sdk;
import dev.openfeature.sdk.internal.ExcludeFromGeneratedCoverageReport;
import lombok.experimental.Delegate;
import java.util.Map;
import java.util.Optional;
import java.util.function.Function;
/**
* ImmutableTrackingEventDetails represents data pertinent to a particular tracking event.
*/
public class ImmutableTrackingEventDetails implements TrackingEventDetails {
@Delegate(excludes = DelegateExclusions.class)
private final ImmutableStructure structure;
private final Number value;
public ImmutableTrackingEventDetails() {
this.value = null;
this.structure = new ImmutableStructure();
}
public ImmutableTrackingEventDetails(final Number value) {
this.value = value;
this.structure = new ImmutableStructure();
}
public ImmutableTrackingEventDetails(final Number value, final Map<String, Value> attributes) {
this.value = value;
this.structure = new ImmutableStructure(attributes);
}
/**
* Returns the optional tracking value.
*/
public Optional<Number> getValue() {
return Optional.ofNullable(value);
}
@SuppressWarnings("all")
private static class DelegateExclusions {
@ExcludeFromGeneratedCoverageReport
public <T extends Structure> Map<String, Value> merge(Function<Map<String, Value>, Structure> newStructure,
Map<String, Value> base,
Map<String, Value> overriding) {
return null;
}
}
}