Package com.helger.dao
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
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classIDAO.EMode
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description intgetInitCount()LocalDateTimegetLastInitDateTime()LocalDateTimegetLastReadDateTime()LocalDateTimegetLastWriteDateTime()intgetReadCount()intgetWriteCount()booleanhasPendingChanges()default booleanisReloadable()default voidreload()The method that is invoke if a DAO is reloaded.voidwriteToFileOnPendingChanges()This method is called to persist the content in disk in case there are pending changes.-
Methods inherited from interface com.helger.dao.IAutoSaveAware
beginWithoutAutoSave, endWithoutAutoSave, isAutoSaveEnabled, performWithoutAutoSave, performWithoutAutoSave, performWithoutAutoSaveThrowing, performWithoutAutoSaveThrowing
-
-
-
-
Method Detail
-
hasPendingChanges
boolean hasPendingChanges()
- Returns:
trueif there are pending changes,falseif 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
nullif 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
nullif 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
nullif it wasn't written before. Usually this field is not persistent and only is valid until the application ends.
-
isReloadable
default boolean isReloadable()
- Returns:
trueif this DAO support re-loading,falseotherwise.- See Also:
reload()
-
reload
default void reload() throws DAOExceptionThe method that is invoke if a DAO is reloaded. This method is only triggered if this DAO indicates that it is reloadable viaisReloadable().- Throws:
DAOException- In case reloading fails
-
-