Class GenericFileStorage<V extends Serializable>

    • Constructor Detail

      • GenericFileStorage

        public GenericFileStorage​(Class<V> clazz)
      • GenericFileStorage

        public GenericFileStorage​(Class<V> clazz,
                                  String fileExtension)
      • GenericFileStorage

        public GenericFileStorage​(Class<V> clazz,
                                  String fileExtension,
                                  String subfolder)
    • Method Detail

      • create

        public String create​(V value)
        Method for storing an given object
        Parameters:
        value - Object which should be stored
        Returns:
        The key of the stored object
      • create

        public String create​(V value,
                             String suggestedKey)
        Method for storing an given object
        Parameters:
        value - Object which should be stored
        suggestedKey - Suggested Key for storing the object (does not have to be considered! check return value)
        Returns:
        The key of the stored object
      • read

        public V read​(String key)
        Method for reading an object identified by the given key
        Parameters:
        key - Key to identify the object which should be read
        Returns:
        The Object identified by the key or NULL if no object is identified by the given key.
      • read

        public Collection<V> read()
        Method for reading all objects managed by the storage
        Returns:
        Collection of all managed objects
      • update

        public boolean update​(String key,
                              V value)
        Method for updating the stored object at a given key
        Parameters:
        key - Key to identify the object which should be updated
        value - Object which should be restored
        Returns:
        True if object was updated; else false
      • delete

        public boolean delete​(String key)
        Method for deleting a stored object
        Parameters:
        key - Key to identify the object which should be deleted
        Returns:
        True if object was deleted; else false
      • deleteAll

        public boolean deleteAll()
        Method for deleting all stored objects Attention: If corresponding folder is used by multiple users/application this method does not take response for them! Only use it if the folder is only touched by this Storage
        Returns:
        True if object was deleted; else false