Interface Reloader

All Known Implementing Classes:
Reloader.Default

public interface Reloader
Utility to reload objects or object graphs. Reload means that the in-memory state of the objects is reset to the state of the underlying storage.

Usage:

 EmbeddedStorageManager storage = ...;
 Reloader reloader = Reloader.New(storage.persistenceManager());
 reloader.reloadFlat(obj); // reloads only the given object, but not its references
 reloader.reloadDeep(obj); // reloads the complete object graph
 
Since:
08.00.00
  • Nested Class Summary

    Nested Classes 
    Modifier and Type Interface Description
    static class  Reloader.Default  
  • Method Summary

    Modifier and Type Method Description
    static Reloader New​(PersistenceManager<?> persistenceManager)
    Pseudo-constructor method to create a new Reloader.
    <T> T reloadDeep​(T instance)
    Resets the state of the given instance and all of its references to the state of the underlying storage.
    <T> T reloadFlat​(T instance)
    Resets the state of the given instance to the state of the underlying storage.
  • Method Details

    • reloadFlat

      <T> T reloadFlat​(T instance)
      Resets the state of the given instance to the state of the underlying storage. But not its references.
      Type Parameters:
      T - type of the instance
      Parameters:
      instance - the object to reload
      Returns:
      the reloaded object, or null if it was not found in the storage
    • reloadDeep

      <T> T reloadDeep​(T instance)
      Resets the state of the given instance and all of its references to the state of the underlying storage.
      Type Parameters:
      T - type of the instance
      Parameters:
      instance - the object to reload
      Returns:
      the reloaded object, or null if it was not found in the storage
    • New

      static Reloader New​(PersistenceManager<?> persistenceManager)
      Pseudo-constructor method to create a new Reloader.
      Parameters:
      persistenceManager - the persistence manager to reload from
      Returns:
      a newly created Reloader