org.faktorips.runtime
Class SimpleCache

java.lang.Object
  extended by org.faktorips.runtime.SimpleCache
All Implemented Interfaces:
IComputable<Object,Object>

public class SimpleCache
extends Object
implements IComputable<Object,Object>

Simple cache that just uses a HashMap to cache objects and never releases them. This Cache is thread safe but not very high-performance.

Author:
Jan Ortmann

Constructor Summary
SimpleCache(IComputable<Object,Object> computable)
           
SimpleCache(IComputable<Object,Object> computable, int initialCapacity)
           
 
Method Summary
 Object compute(Object key)
          Compute an object of type V identified by the key of type K
 Class<? super Object> getValueClass()
          Getting the Class of the value this computable produces.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleCache

public SimpleCache(IComputable<Object,Object> computable)

SimpleCache

public SimpleCache(IComputable<Object,Object> computable,
                   int initialCapacity)
Method Detail

compute

public Object compute(Object key)
               throws InterruptedException
Description copied from interface: IComputable
Compute an object of type V identified by the key of type K

Specified by:
compute in interface IComputable<Object,Object>
Parameters:
key - the key to identify the object
Returns:
the computed Object of type V
Throws:
InterruptedException - When computation was interrupted

getValueClass

public Class<? super Object> getValueClass()
Description copied from interface: IComputable
Getting the Class of the value this computable produces.

Specified by:
getValueClass in interface IComputable<Object,Object>


Copyright © 2015. All rights reserved.