-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathSdkUpdateMetadata.java
More file actions
75 lines (65 loc) · 2.08 KB
/
SdkUpdateMetadata.java
File metadata and controls
75 lines (65 loc) · 2.08 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
package io.split.android.client.events;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import java.util.Collections;
import java.util.List;
/**
* Typed metadata for SDK_UPDATE events.
* <p>
* Contains information about the type of update and the names of entities that were updated.
*/
public final class SdkUpdateMetadata {
/**
* The type of update that triggered the SDK_UPDATE event.
*/
public enum Type {
/**
* Feature flags were updated.
* <p>
* {@link #getNames()} returns the list of flag names that changed.
*/
FLAGS_UPDATE,
/**
* Segments were updated (rule-based segments, memberships, or large segments).
* <p>
* Note: {@link #getNames()} always returns an empty list for this type.
* Segment names are not included in the metadata.
*/
SEGMENTS_UPDATE
}
@Nullable
private final Type mType;
@NonNull
private final List<String> mNames;
/**
* Creates a new SdkUpdateMetadata instance.
*
* @param type the type of update, or null if not available
* @param names the list of entity names that were updated, or null to use an empty list
*/
public SdkUpdateMetadata(@Nullable Type type, @Nullable List<String> names) {
mType = type;
mNames = names != null ? names : Collections.emptyList();
}
/**
* Returns the type of update that triggered this event.
*
* @return the update type, or null if not available
*/
@Nullable
public Type getType() {
return mType;
}
/**
* Returns the list of entity names that changed in this update.
* <p>
* For {@link Type#FLAGS_UPDATE}, this contains flag names that were updated.
* For {@link Type#SEGMENTS_UPDATE}, this is always an empty list (segment names are not included).
*
* @return the list of updated entity names, never null (empty list for SEGMENTS_UPDATE or if none)
*/
@NonNull
public List<String> getNames() {
return mNames;
}
}