Class AbstractDataStore<V extends java.io.Serializable>

  • Type Parameters:
    V - serializable type of the mapped value
    All Implemented Interfaces:
    DataStore<V>
    Direct Known Subclasses:
    AbstractMemoryDataStore

    public abstract class AbstractDataStore<V extends java.io.Serializable>
    extends java.lang.Object
    implements DataStore<V>
    Abstract data store implementation.
    Since:
    1.16
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean containsKey​(java.lang.String key)
      Returns whether the store contains the given key.
      boolean containsValue​(V value)
      Returns whether the store contains the given value.
      DataStoreFactory getDataStoreFactory()
      Returns the data store factory.
      java.lang.String getId()
      Returns the data store ID.
      boolean isEmpty()
      Returns whether there are any stored keys.
      int size()
      Returns the number of stored keys.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • dataStoreFactory

        private final DataStoreFactory dataStoreFactory
        Data store factory.
      • id

        private final java.lang.String id
        Data store ID.
    • Constructor Detail

      • AbstractDataStore

        protected AbstractDataStore​(DataStoreFactory dataStoreFactory,
                                    java.lang.String id)
        Parameters:
        dataStoreFactory - data store factory
        id - data store ID
    • Method Detail

      • getDataStoreFactory

        public DataStoreFactory getDataStoreFactory()
        Returns the data store factory.

        Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.

        Specified by:
        getDataStoreFactory in interface DataStore<V extends java.io.Serializable>
      • getId

        public final java.lang.String getId()
        Description copied from interface: DataStore
        Returns the data store ID.
        Specified by:
        getId in interface DataStore<V extends java.io.Serializable>
      • containsKey

        public boolean containsKey​(java.lang.String key)
                            throws java.io.IOException
        Returns whether the store contains the given key.

        Default implementation is to call DataStore.get(String) and check if it is null.

        Specified by:
        containsKey in interface DataStore<V extends java.io.Serializable>
        Throws:
        java.io.IOException
      • containsValue

        public boolean containsValue​(V value)
                              throws java.io.IOException
        Returns whether the store contains the given value.

        Default implementation is to call Collection.contains(Object) on DataStore.values().

        Specified by:
        containsValue in interface DataStore<V extends java.io.Serializable>
        Throws:
        java.io.IOException
      • isEmpty

        public boolean isEmpty()
                        throws java.io.IOException
        Returns whether there are any stored keys.

        Default implementation is to check if size() is 0.

        Specified by:
        isEmpty in interface DataStore<V extends java.io.Serializable>
        Throws:
        java.io.IOException
      • size

        public int size()
                 throws java.io.IOException
        Returns the number of stored keys.

        Default implementation is to call Set.size() on DataStore.keySet().

        Specified by:
        size in interface DataStore<V extends java.io.Serializable>
        Throws:
        java.io.IOException