Class MapPersister

java.lang.Object
org.oddjob.persist.PersisterBase
org.oddjob.persist.MapPersister
All Implemented Interfaces:
OddjobPersister

public class MapPersister extends PersisterBase
A Memory based OddjobPersister.
Author:
rob
  • Constructor Details

    • MapPersister

      public MapPersister()
      Create a new instance with a standard HashMap.
    • MapPersister

      public MapPersister(Map<Path,Map<String,byte[]>> store)
      Create a new instance with the provided map. Access to this map will be synchronized so the map itself need not be.
      Parameters:
      store - A Map. Must not be null.
  • Method Details

    • persist

      protected void persist(Path path, String id, Object proxy)
      Description copied from class: PersisterBase
      Provided by subclasses to do the persisting.
      Specified by:
      persist in class PersisterBase
      Parameters:
      path - The path as a string. Never null.
      id - The id. Never Null.
      proxy - The component or it's proxy.
    • restore

      protected Object restore(Path path, String id, ClassLoader classLoader)
      Description copied from class: PersisterBase
      Restore a previously persisted Component or it's Proxy.
      Specified by:
      restore in class PersisterBase
      Parameters:
      path - The path. Never Null.
      id - The id. Never Null.
      classLoader - The classLoader.
      Returns:
      The component or it's proxy. Null if nothing had previously been persisted for this path and id.
    • list

      protected String[] list(Path path) throws ComponentPersistException
      Specified by:
      list in class PersisterBase
      Throws:
      ComponentPersistException
    • remove

      protected void remove(Path path, String id)
      Description copied from class: PersisterBase
      Remove a possibly previously persisted object.
      Specified by:
      remove in class PersisterBase
      Parameters:
      path - The path.
      id - The id.
    • clear

      protected void clear(Path path)
      Description copied from class: PersisterBase
      Remove a possibly previously persisted object.
      Specified by:
      clear in class PersisterBase
      Parameters:
      path - The path.
    • toString

      public String toString()
      Overrides:
      toString in class Object