Class DataStoreTypes.ItemDescriptor

  • Enclosing class:

    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

      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.
        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.
        the version number
      • getItem

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

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

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

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

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