Interface EntityCache

  • All Superinterfaces:
    Session
    All Known Implementing Classes:
    EntityCacheImpl

    public interface EntityCache
    extends Session
    This is a cache for Entity instances during the execution of one Command.
    Author:
    Joram Barrez
    • Method Detail

      • getAllCachedEntities

        Map<Class<?>,​Map<String,​CachedEntity>> getAllCachedEntities()
        Returns all cached Entity instances as a map with following structure: { entityClassName, {entityId, entity} }
      • put

        CachedEntity put​(Entity entity,
                         boolean storeState)
        Adds the gives Entity to the cache.
        Parameters:
        entity - The Entity instance
        storeState - If true, the current state Entity.getPersistentState() will be stored for future diffing. Note that, if false, the Entity will always be seen as changed.
        Returns:
        Returns a CachedEntity instance, which can be enriched later on.
      • findInCache

        <T> T findInCache​(Class<T> entityClass,
                          String id)
        Returns the cached Entity instance of the given class with the provided id. Returns null if such a Entity cannot be found.
      • findInCache

        <T> List<T> findInCache​(Class<T> entityClass)
        Returns all cached Entity instances of a given type. Returns an empty list if no instances of the given type exist.
      • cacheRemove

        void cacheRemove​(Class<?> entityClass,
                         String entityId)
        Removes the Entity of the given type with the given id from the cache.