org.specrunner.util.cache.core
Class AbstractCacheFactory

java.lang.Object
  extended by org.specrunner.util.cache.core.AbstractCacheFactory
All Implemented Interfaces:
ICacheFactory
Direct Known Subclasses:
CacheFactoryDefault

public abstract class AbstractCacheFactory
extends Object
implements ICacheFactory

Abstract implementation of a factory.

Author:
Thiago Santos

Constructor Summary
AbstractCacheFactory()
           
 
Method Summary
protected abstract
<K,T> ICache<K,T>
create(String name, ICacheCleaner<T> cleaner)
          Create the cache object.
<K,T> ICache<K,T>
newCache(String name)
          Creates a new cache.
<K,T> ICache<K,T>
newCache(String name, ICacheCleaner<T> cleaner)
          Creates a new cache.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractCacheFactory

public AbstractCacheFactory()
Method Detail

newCache

public <K,T> ICache<K,T> newCache(String name)
Description copied from interface: ICacheFactory
Creates a new cache.

Specified by:
newCache in interface ICacheFactory
Type Parameters:
K - Key type.
T - Cache object type.
Parameters:
name - Cache name.
Returns:
A cache.

newCache

public <K,T> ICache<K,T> newCache(String name,
                                  ICacheCleaner<T> cleaner)
Description copied from interface: ICacheFactory
Creates a new cache.

Specified by:
newCache in interface ICacheFactory
Type Parameters:
K - Key type.
T - Cache object type.
Parameters:
name - Cache name.
cleaner - A cleaner of objects in cache when it overloads.
Returns:
A cache.

create

protected abstract <K,T> ICache<K,T> create(String name,
                                            ICacheCleaner<T> cleaner)
Create the cache object.

Type Parameters:
K - Key type.
T - Cache object type.
Parameters:
name - Cache name.
cleaner - A cache cleaner.
Returns:
The cache instance.


Copyright © 2014. All rights reserved.