Skip to content
This repository was archived by the owner on May 30, 2024. It is now read-only.

Commit 0365703

Browse files
authored
Merge pull request #71 from launchdarkly/eb/ch17082/list-of-types
add list of all data kinds
2 parents 52b148a + 8edb543 commit 0365703

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

src/main/java/com/launchdarkly/client/VersionedDataKind.java

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
package com.launchdarkly.client;
22

3+
import com.google.common.collect.ImmutableList;
4+
35
/**
46
* The descriptor for a specific kind of {@link VersionedData} objects that may exist in a {@link FeatureStore}.
7+
* You will not need to refer to this type unless you are directly manipulating a {@code FeatureStore}
8+
* or writing your own {@code FeatureStore} implementation. If you are implementing a custom store, for
9+
* maximum forward compatibility you should only refer to {@link VersionedData}, {@link VersionedDataKind},
10+
* and {@link VersionedDataKind#ALL}, and avoid any dependencies on specific type descriptor instances
11+
* or any specific fields of the types they describe.
512
* @since 3.0.0
613
*/
714
public abstract class VersionedDataKind<T extends VersionedData> {
@@ -41,7 +48,9 @@ String getKeyFromStreamApiPath(String path) {
4148
return path.startsWith(getStreamApiPath()) ? path.substring(getStreamApiPath().length()) : null;
4249
}
4350

44-
51+
/**
52+
* The {@link VersionedDataKind} instance that describes feature flag data.
53+
*/
4554
public static VersionedDataKind<FeatureFlag> FEATURES = new VersionedDataKind<FeatureFlag>() {
4655

4756
public String getNamespace() {
@@ -61,6 +70,9 @@ public FeatureFlag makeDeletedItem(String key, int version) {
6170
}
6271
};
6372

73+
/**
74+
* The {@link VersionedDataKind} instance that describes user segment data.
75+
*/
6476
public static VersionedDataKind<Segment> SEGMENTS = new VersionedDataKind<Segment>() {
6577

6678
public String getNamespace() {
@@ -79,4 +91,10 @@ public Segment makeDeletedItem(String key, int version) {
7991
return new Segment.Builder(key).deleted(true).version(version).build();
8092
}
8193
};
94+
95+
/**
96+
* A list of all existing instances of {@link VersionedDataKind}.
97+
* @since 4.1.0
98+
*/
99+
public static Iterable<VersionedDataKind<?>> ALL = ImmutableList.of(FEATURES, SEGMENTS);
82100
}

0 commit comments

Comments
 (0)