Package jadex.commons

Class CachedObject

  • All Implemented Interfaces:
    java.io.Serializable

    public class CachedObject
    extends java.lang.Object
    implements java.io.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:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.io.Serializable cachedobject
      The cached object.
      protected java.lang.String filename
      The filename of the cache.
      protected long lastmodified
      The 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.String getFilename()
      Get the filename.
      long getLastModified()
      Get the last modified date.
      java.io.Serializable getObject()
      Get the cached object
      void persist()
      Persist the cached object.
      void setFilename​(java.lang.String filename)
      Set the filename.
      void setLastModified​(long lastmodified)
      Set the last modified date.
      void setObject​(java.io.Serializable cachedobject)
      Set the cached object.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • cachedobject

        protected java.io.Serializable cachedobject
        The cached object.
      • filename

        protected java.lang.String filename
        The filename of the cache.
      • lastmodified

        protected long lastmodified
        The last modified date.
    • Constructor Detail

      • CachedObject

        public CachedObject​(java.lang.String filename,
                            long lastmodified,
                            java.io.Serializable cachedobject)
        Create a new file cache.
    • 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.IOException
        Persist the cached object.
        Throws:
        java.io.IOException