Interface IIdNameCache<T>

  • Type Parameters:
    T -
    All Known Implementing Classes:
    IdNameCache

    public interface IIdNameCache<T>
    Interface to a cache mapping an id of type T to a string. Supports thread-local caching to support temporary staging of values pending successful completion of a transaction.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void addEntry​(T id, java.lang.String name)
      Add the entry to the local cache
      void clearLocalMaps()
      Clear anything cached in thread-local (after transaction rollback, for example)
      java.util.Collection<java.lang.String> getAllNames()
      Get all names in the cache
      java.lang.String getName​(T id)
      Get the name for the given id
      void prefill​(java.util.Map<T,​java.lang.String> content)
      Prefill the shared map with the given content (must come data already committed in the database)
      void reset()
      Clear both local shared caches - useful for unit tests
      void updateSharedMaps()
      Called after a transaction commit() to transfer all the staged (thread-local) data over to the shared cache.
    • Method Detail

      • getName

        java.lang.String getName​(T id)
        Get the name for the given id
        Parameters:
        id -
        Returns:
      • getAllNames

        java.util.Collection<java.lang.String> getAllNames()
        Get all names in the cache
        Returns:
      • addEntry

        void addEntry​(T id,
                      java.lang.String name)
        Add the entry to the local cache
        Parameters:
        id -
        name -
      • updateSharedMaps

        void updateSharedMaps()
        Called after a transaction commit() to transfer all the staged (thread-local) data over to the shared cache.
      • reset

        void reset()
        Clear both local shared caches - useful for unit tests
      • clearLocalMaps

        void clearLocalMaps()
        Clear anything cached in thread-local (after transaction rollback, for example)
      • prefill

        void prefill​(java.util.Map<T,​java.lang.String> content)
        Prefill the shared map with the given content (must come data already committed in the database)
        Parameters:
        content -