Class DataStoreTypes.ItemDescriptor

  • Enclosing class:
    DataStoreTypes

    public static final class DataStoreTypes.ItemDescriptor
    extends java.lang.Object
    A versioned item (or placeholder) storable in a DataStore.

    This is used for data stores that directly store objects as-is, as the default in-memory store does. Items are typed as Object; the store should not know or care what the actual object is.

    For any given key within a DataStoreTypes.DataKind, there can be either an existing item with a version, or a "tombstone" placeholder representing a deleted item (also with a version). Deleted item placeholders are used so that if an item is first updated with version N and then deleted with version N+1, but the SDK receives those changes out of order, version N will not overwrite the deletion.

    Persistent data stores use DataStoreTypes.SerializedItemDescriptor instead.

    • Constructor Summary

      Constructors 
      Constructor Description
      ItemDescriptor​(int version, java.lang.Object item)
      Constructs a new instance.
    • Constructor Detail

      • ItemDescriptor

        public ItemDescriptor​(int version,
                              java.lang.Object item)
        Constructs a new instance.
        Parameters:
        version - the version number
        item - an object or null
    • Method Detail

      • getVersion

        public int getVersion()
        Returns the version number of this data, provided by the SDK.
        Returns:
        the version number
      • getItem

        public java.lang.Object getItem()
        Returns the data item, or null if this is a placeholder for a deleted item.
        Returns:
        an object or null
      • deletedItem

        public static DataStoreTypes.ItemDescriptor deletedItem​(int version)
        Convenience method for constructing a deleted item placeholder.
        Parameters:
        version - the version number
        Returns:
        an ItemDescriptor
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object