public abstract class PersistentItem<T extends Serializable> extends Object implements PersistenceHandler<T>
new PersistentItem<DataTypeToPersist>(fileToStore, refreshDelay) { public void onLoad() { //... } // The other methods to overload // ... }
Modifier and Type | Field and Description |
---|---|
protected static String |
LOG_PREFIX |
Constructor and Description |
---|
PersistentItem()
Deprecated.
for internal use only.
|
PersistentItem(String persistenceFileName) |
PersistentItem(String persistenceFileName,
long refreshDelay) |
PersistentItem(T data,
String persistenceFileName,
long refreshDelay) |
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Requires the destroy of the persistent resource.
|
T |
getData()
Returns the corresponding persistent data.
|
void |
setData(T data)
Sets the new data to persist.
|
protected void |
setPersistenceFileName(String persistenceFileName) |
protected void |
setRefreshDelay(long refreshDelay) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
onDestroy, onLoad, onRefresh
protected static final String LOG_PREFIX
public PersistentItem()
public PersistentItem(String persistenceFileName)
public PersistentItem(String persistenceFileName, long refreshDelay)
protected final void setPersistenceFileName(String persistenceFileName)
protected final void setRefreshDelay(long refreshDelay)
public final void destroy()
PersistenceHandler
destroy
in interface PersistenceHandler<T extends Serializable>
public final T getData()
getData
in interface PersistenceHandler<T extends Serializable>
public final void setData(T data)
PersistenceHandler
setData
in interface PersistenceHandler<T extends Serializable>
Copyright © 2019. All Rights Reserved.