Class DataStoreTypes.DataKind
- java.lang.Object
-
- com.launchdarkly.sdk.server.subsystems.DataStoreTypes.DataKind
-
- Enclosing class:
- DataStoreTypes
public static final class DataStoreTypes.DataKind extends java.lang.ObjectRepresents a separately namespaced collection of storable data items.The SDK passes instances of this type to the data store to specify whether it is referring to a feature flag, a user segment, etc. The data store implementation should not look for a specific data kind (such as feature flags), but should treat all data kinds generically.
-
-
Constructor Summary
Constructors Constructor Description DataKind(java.lang.String name, java.util.function.Function<DataStoreTypes.ItemDescriptor,java.lang.String> serializer, java.util.function.Function<java.lang.String,DataStoreTypes.ItemDescriptor> deserializer)Constructs a DataKind instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DataStoreTypes.ItemDescriptordeserialize(java.lang.String s)Creates an item of this kind from its serialized representation.java.lang.StringgetName()A case-sensitive alphabetic string that uniquely identifies this data kind.java.lang.Stringserialize(DataStoreTypes.ItemDescriptor item)Returns a serialized representation of an item of this kind.java.lang.StringtoString()
-
-
-
Constructor Detail
-
DataKind
public DataKind(java.lang.String name, java.util.function.Function<DataStoreTypes.ItemDescriptor,java.lang.String> serializer, java.util.function.Function<java.lang.String,DataStoreTypes.ItemDescriptor> deserializer)Constructs a DataKind instance.- Parameters:
name- the value forgetName()serializer- the function to use forserialize(DataStoreTypes.ItemDescriptor)deserializer- the function to use fordeserialize(String)
-
-
Method Detail
-
getName
public java.lang.String getName()
A case-sensitive alphabetic string that uniquely identifies this data kind.This is in effect a namespace for a collection of items of the same kind. Item keys must be unique within that namespace. Persistent data store implementations could use this string as part of a composite key or table name.
- Returns:
- the namespace string
-
serialize
public java.lang.String serialize(DataStoreTypes.ItemDescriptor item)
Returns a serialized representation of an item of this kind.The SDK uses this function to generate the data that is stored by a
PersistentDataStore. Store implementations normally do not need to call it, except in a special case described in the documentation forPersistentDataStoreregarding deleted item placeholders.- Parameters:
item- anDataStoreTypes.ItemDescriptordescribing the object to be serialized- Returns:
- the serialized representation
- Throws:
java.lang.ClassCastException- if the object is of the wrong class
-
deserialize
public DataStoreTypes.ItemDescriptor deserialize(java.lang.String s)
Creates an item of this kind from its serialized representation.The SDK uses this function to translate data that is returned by a
PersistentDataStore. Store implementations do not normally need to call it, but there is a special case described in the documentation forPersistentDataStore, regarding updates.The returned
DataStoreTypes.ItemDescriptorhas two properties:DataStoreTypes.ItemDescriptor.getItem(), which is the deserialized object or anullvalue for a deleted item placeholder, andDataStoreTypes.ItemDescriptor.getVersion(), which provides the object's version number regardless of whether it is deleted or not.- Parameters:
s- the serialized representation- Returns:
- an
DataStoreTypes.ItemDescriptordescribing the deserialized object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-