Package jadex.collection
Class CachedObject
java.lang.Object
jadex.collection.CachedObject
- All Implemented Interfaces:
Serializable
A cache for an object that was loaded from a file or url.
The cache can be made persistent on disk (uses the filename).
For a new cache the object to be cached can be set.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Serializable
The cached object.protected String
The filename of the cache.protected long
The last modified date. -
Constructor Summary
ConstructorsConstructorDescriptionCachedObject
(String filename, long lastmodified, Serializable cachedobject) Create a new file cache. -
Method Summary
Modifier and TypeMethodDescriptionGet the filename.long
Get the last modified date.Get the cached objectvoid
persist()
Persist the cached object.void
setFilename
(String filename) Set the filename.void
setLastModified
(long lastmodified) Set the last modified date.void
setObject
(Serializable cachedobject) Set the cached object.
-
Field Details
-
cachedobject
The cached object. -
filename
The filename of the cache. -
lastmodified
protected long lastmodifiedThe last modified date.
-
-
Constructor Details
-
CachedObject
Create a new file cache.
-
-
Method Details
-
setObject
Set the cached object.- Parameters:
cachedobject
- The cached object.
-
getObject
Get the cached object- Returns:
- The cached object.
-
getLastModified
public long getLastModified()Get the last modified date.- Returns:
- The last modified date.
-
setLastModified
public void setLastModified(long lastmodified) Set the last modified date.- Parameters:
lastmodified
- The last modified date.
-
getFilename
Get the filename.- Returns:
- The file name.
-
setFilename
Set the filename.- Parameters:
filename
- The file name.
-
persist
Persist the cached object.- Throws:
IOException
-