Interface IDAO

All Superinterfaces:
IAutoSaveAware
All Known Implementing Classes:
AbstractDAO, AbstractMapBasedWALDAO, AbstractSimpleDAO, AbstractWALDAO

public interface IDAO extends IAutoSaveAware
Base DAO interface. DAO = Data Access Object. A DAO implementation usually has 3 basic operations:
  • Initialization - when no file exists and an initial setup can be performed.
  • Reading - read existing data from a file
  • Write - write modified data to a file
Author:
Philip Helger
  • Method Details

    • hasPendingChanges

      boolean hasPendingChanges()
      Returns:
      true if there are pending changes, false if the content is unchanged.
    • writeToFileOnPendingChanges

      void writeToFileOnPendingChanges()
      This method is called to persist the content in disk in case there are pending changes. If no pending changes are present, nothing happens. In case the implementation is thread-safe, this method must be thread-safe!
    • getInitCount

      @Nonnegative int getInitCount()
      Returns:
      The number of times this DAO was initialized. Always ≥ 0. Usually this field is not persistent and only is valid until the application ends.
    • getLastInitDateTime

      @Nullable LocalDateTime getLastInitDateTime()
      Returns:
      The last time this DAO was initialized (without error). May be null if it wasn't read before. Usually this field is not persistent and only is valid until the application ends.
    • getReadCount

      @Nonnegative int getReadCount()
      Returns:
      The number of times this DAO was initialized. Always ≥ 0. Usually this field is not persistent and only is valid until the application ends.
    • getLastReadDateTime

      @Nullable LocalDateTime getLastReadDateTime()
      Returns:
      The last time this DAO was read (without error). May be null if it wasn't read before. Usually this field is not persistent and only is valid until the application ends.
    • getWriteCount

      @Nonnegative int getWriteCount()
      Returns:
      The number of times this DAO was initialized. Always ≥ 0. Usually this field is not persistent and only is valid until the application ends.
    • getLastWriteDateTime

      @Nullable LocalDateTime getLastWriteDateTime()
      Returns:
      The last time this DAO was written (without error). May be null if it wasn't written before. Usually this field is not persistent and only is valid until the application ends.
    • isReloadable

      default boolean isReloadable()
      Returns:
      true if this DAO support re-loading, false otherwise.
      See Also:
    • reload

      default void reload() throws DAOException
      The method that is invoke if a DAO is reloaded. This method is only triggered if this DAO indicates that it is reloadable via isReloadable().
      Throws:
      DAOException - In case reloading fails