Package jadex.commons
Class CachedObject
- java.lang.Object
-
- jadex.commons.CachedObject
-
- All Implemented Interfaces:
java.io.Serializable
public class CachedObject extends java.lang.Object implements java.io.SerializableA 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:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected java.io.SerializablecachedobjectThe cached object.protected java.lang.StringfilenameThe filename of the cache.protected longlastmodifiedThe last modified date.
-
Constructor Summary
Constructors Constructor Description CachedObject(java.lang.String filename, long lastmodified, java.io.Serializable cachedobject)Create a new file cache.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetFilename()Get the filename.longgetLastModified()Get the last modified date.java.io.SerializablegetObject()Get the cached objectvoidpersist()Persist the cached object.voidsetFilename(java.lang.String filename)Set the filename.voidsetLastModified(long lastmodified)Set the last modified date.voidsetObject(java.io.Serializable cachedobject)Set the cached object.
-
-
-
Method Detail
-
setObject
public void setObject(java.io.Serializable cachedobject)
Set the cached object.- Parameters:
cachedobject- The cached object.
-
getObject
public java.io.Serializable 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
public java.lang.String getFilename()
Get the filename.- Returns:
- The file name.
-
setFilename
public void setFilename(java.lang.String filename)
Set the filename.- Parameters:
filename- The file name.
-
persist
public void persist() throws java.io.IOExceptionPersist the cached object.- Throws:
java.io.IOException
-
-