@ThreadSafe public abstract class AbstractDAO extends Object implements IDAO
IDAOIDAO.EMode| Modifier and Type | Field and Description |
|---|---|
static boolean |
DEFAULT_AUTO_SAVE_ENABLED
By default auto-save is enabled
|
protected com.helger.commons.concurrent.SimpleReadWriteLock |
m_aRWLock |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractDAO() |
| Modifier and Type | Method and Description |
|---|---|
void |
beginWithoutAutoSave()
Start doing something without auto save.
|
void |
endWithoutAutoSave()
End doing something without auto save.
|
static com.helger.commons.callback.CallbackList<IDAOReadExceptionCallback> |
getExceptionHandlersRead() |
static com.helger.commons.callback.CallbackList<IDAOWriteExceptionCallback> |
getExceptionHandlersWrite() |
boolean |
hasPendingChanges() |
boolean |
internalHasPendingChanges() |
protected boolean |
internalIsAutoSaveEnabled() |
void |
internalSetPendingChanges(boolean bPendingChanges) |
boolean |
isAutoSaveEnabled() |
protected static boolean |
isDebugLogging() |
void |
performWithoutAutoSave(Runnable aRunnable)
Execute a callback with autosave being disabled.
|
<RETURNTYPE> |
performWithoutAutoSave(Supplier<RETURNTYPE> aCallable)
Execute a callback with autosave being disabled.
|
<EXTYPE extends Exception> |
performWithoutAutoSaveThrowing(com.helger.commons.callback.IThrowingRunnable<EXTYPE> aRunnable)
Execute a callback with autosave being disabled.
|
<RETURNTYPE,EXTYPE extends Exception> |
performWithoutAutoSaveThrowing(com.helger.commons.function.IThrowingSupplier<RETURNTYPE,EXTYPE> aCallable)
Execute a callback with autosave being disabled.
|
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetInitCount, getLastInitDateTime, getLastReadDateTime, getLastWriteDateTime, getReadCount, getWriteCount, writeToFileOnPendingChangespublic static final boolean DEFAULT_AUTO_SAVE_ENABLED
protected final com.helger.commons.concurrent.SimpleReadWriteLock m_aRWLock
protected static final boolean isDebugLogging()
@Nonnull @ReturnsMutableObject(value="design") public static final com.helger.commons.callback.CallbackList<IDAOReadExceptionCallback> getExceptionHandlersRead()
@Nonnull @ReturnsMutableObject(value="design") public static final com.helger.commons.callback.CallbackList<IDAOWriteExceptionCallback> getExceptionHandlersWrite()
@MustBeLocked(value=READ) protected final boolean internalIsAutoSaveEnabled()
true if auto save is enabled, false
otherwise.public final boolean isAutoSaveEnabled()
isAutoSaveEnabled in interface IAutoSaveAwaretrue if auto save is enabled, false
otherwise.@MustBeLocked(value=WRITE) public final void internalSetPendingChanges(boolean bPendingChanges)
@MustBeLocked(value=READ) public final boolean internalHasPendingChanges()
true if unsaved changes are presentpublic final boolean hasPendingChanges()
hasPendingChanges in interface IChangeabletrue if unsaved changes are presentpublic final void beginWithoutAutoSave()
IAutoSaveAwarebeginWithoutAutoSave in interface IAutoSaveAwarepublic final void endWithoutAutoSave()
IAutoSaveAwareIAutoSaveAware.beginWithoutAutoSave() is always correctly ended with a call to
this method.endWithoutAutoSave in interface IAutoSaveAwarepublic final void performWithoutAutoSave(@Nonnull Runnable aRunnable)
performWithoutAutoSave in interface IAutoSaveAwareaRunnable - The callback to be executed@Nullable public final <RETURNTYPE> RETURNTYPE performWithoutAutoSave(@Nonnull Supplier<RETURNTYPE> aCallable)
performWithoutAutoSave in interface IAutoSaveAwareRETURNTYPE - Return type of the callableaCallable - The callback to be executednull.public final <EXTYPE extends Exception> void performWithoutAutoSaveThrowing(@Nonnull com.helger.commons.callback.IThrowingRunnable<EXTYPE> aRunnable) throws EXTYPE extends Exception
EXTYPE - Exception type that may be thrownaRunnable - The callback to be executedEXTYPE - In case of an errorEXTYPE extends Exception@Nullable public final <RETURNTYPE,EXTYPE extends Exception> RETURNTYPE performWithoutAutoSaveThrowing(@Nonnull com.helger.commons.function.IThrowingSupplier<RETURNTYPE,EXTYPE> aCallable) throws EXTYPE extends Exception
RETURNTYPE - Return type of the callableEXTYPE - Exception type that may be thrownaCallable - The callback to be executednull.EXTYPE - In case of an errorEXTYPE extends ExceptionCopyright © 2014–2017 Philip Helger. All rights reserved.