Interface DataStore<V extends Serializable>

Type Parameters:
V - serializable type of the mapped value
All Known Implementing Classes:
AbstractDataStore, AbstractMemoryDataStore, FileDataStoreFactory.FileDataStore, JdoDataStoreFactory.JdoDataStore, MemoryDataStoreFactory.MemoryDataStore

public interface DataStore<V extends Serializable>
Stores and manages serializable data of a specific type, where the key is a string and the value is a Serializable object.

null keys or values are not allowed. Implementation should be thread-safe.

Since:
1.16
  • Method Summary

    Modifier and Type
    Method
    Description
    Deletes all of the stored keys and values.
    boolean
    Returns whether the store contains the given key.
    boolean
    Returns whether the store contains the given value.
    Deletes the stored key and value based on the given key, or ignored if the key doesn't already exist.
    get(String key)
    Returns the stored value for the given key or null if not found.
    Returns the data store factory.
    Returns the data store ID.
    boolean
    Returns whether there are any stored keys.
    Returns the unmodifiable set of all stored keys.
    set(String key, V value)
    Stores the given value for the given key (replacing any existing value).
    int
    Returns the number of stored keys.
    Returns the unmodifiable collection of all stored values.
  • Method Details

    • getDataStoreFactory

      DataStoreFactory getDataStoreFactory()
      Returns the data store factory.
    • getId

      String getId()
      Returns the data store ID.
    • size

      int size() throws IOException
      Returns the number of stored keys.
      Throws:
      IOException
    • isEmpty

      boolean isEmpty() throws IOException
      Returns whether there are any stored keys.
      Throws:
      IOException
    • containsKey

      boolean containsKey(String key) throws IOException
      Returns whether the store contains the given key.
      Throws:
      IOException
    • containsValue

      boolean containsValue(V value) throws IOException
      Returns whether the store contains the given value.
      Throws:
      IOException
    • keySet

      Set<String> keySet() throws IOException
      Returns the unmodifiable set of all stored keys.

      Order of the keys is not specified.

      Throws:
      IOException
    • values

      Collection<V> values() throws IOException
      Returns the unmodifiable collection of all stored values.
      Throws:
      IOException
    • get

      V get(String key) throws IOException
      Returns the stored value for the given key or null if not found.
      Parameters:
      key - key or null for null result
      Throws:
      IOException
    • set

      DataStore<V> set(String key, V value) throws IOException
      Stores the given value for the given key (replacing any existing value).
      Parameters:
      key - key
      value - value object
      Throws:
      IOException
    • clear

      DataStore<V> clear() throws IOException
      Deletes all of the stored keys and values.
      Throws:
      IOException
    • delete

      DataStore<V> delete(String key) throws IOException
      Deletes the stored key and value based on the given key, or ignored if the key doesn't already exist.
      Parameters:
      key - key or null to ignore
      Throws:
      IOException