Class EntityCacheImpl

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.util.Map<java.lang.Class<?>,​java.util.Map<java.lang.String,​CachedEntity>> cachedObjects  
    • Constructor Summary

      Constructors 
      Constructor Description
      EntityCacheImpl()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void cacheRemove​(java.lang.Class<?> entityClass, java.lang.String entityId)
      Removes the Entity of the given type with the given id from the cache.
      void close()  
      protected java.util.Map<java.lang.String,​CachedEntity> findClassCacheByCheckingSubclasses​(java.lang.Class<?> entityClass)  
      <T> java.util.List<T> findInCache​(java.lang.Class<T> entityClass)
      Returns all cached Entity instances of a given type.
      <T> T findInCache​(java.lang.Class<T> entityClass, java.lang.String id)
      Returns the cached Entity instance of the given class with the provided id.
      <T> java.util.Collection<CachedEntity> findInCacheAsCachedObjects​(java.lang.Class<T> entityClass)
      Returns all CachedEntity instances for the given type.
      void flush()  
      java.util.Map<java.lang.Class<?>,​java.util.Map<java.lang.String,​CachedEntity>> getAllCachedEntities()
      Returns all cached Entity instances as a map with following structure: { entityClassName, {entityId, entity} }
      CachedEntity put​(Entity entity, boolean storeState)
      Adds the gives Entity to the cache.
      • Methods inherited from class java.lang.Object

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

      • cachedObjects

        protected java.util.Map<java.lang.Class<?>,​java.util.Map<java.lang.String,​CachedEntity>> cachedObjects
    • Constructor Detail

      • EntityCacheImpl

        public EntityCacheImpl()
    • Method Detail

      • findInCache

        public <T> T findInCache​(java.lang.Class<T> entityClass,
                                 java.lang.String id)
        Description copied from interface: EntityCache
        Returns the cached Entity instance of the given class with the provided id. Returns null if such a Entity cannot be found.
        Specified by:
        findInCache in interface EntityCache
      • findClassCacheByCheckingSubclasses

        protected java.util.Map<java.lang.String,​CachedEntity> findClassCacheByCheckingSubclasses​(java.lang.Class<?> entityClass)
      • cacheRemove

        public void cacheRemove​(java.lang.Class<?> entityClass,
                                java.lang.String entityId)
        Description copied from interface: EntityCache
        Removes the Entity of the given type with the given id from the cache.
        Specified by:
        cacheRemove in interface EntityCache
      • findInCache

        public <T> java.util.List<T> findInCache​(java.lang.Class<T> entityClass)
        Description copied from interface: EntityCache
        Returns all cached Entity instances of a given type. Returns an empty list if no instances of the given type exist.
        Specified by:
        findInCache in interface EntityCache
      • getAllCachedEntities

        public java.util.Map<java.lang.Class<?>,​java.util.Map<java.lang.String,​CachedEntity>> getAllCachedEntities()
        Description copied from interface: EntityCache
        Returns all cached Entity instances as a map with following structure: { entityClassName, {entityId, entity} }
        Specified by:
        getAllCachedEntities in interface EntityCache
      • close

        public void close()
        Specified by:
        close in interface Session
      • flush

        public void flush()
        Specified by:
        flush in interface Session