Package org.faktorips.runtime.caching
Interface IComputable<K,V>
-
- All Known Implementing Classes:
AbstractComputable,Memoizer,SimpleCache
public interface IComputable<K,V>Interface to compute objects of type V identified by a key of type K- Author:
- dirmeier
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description Vcompute(K key)Compute an object of type V identified by the key of type Kjava.lang.Class<? super V>getValueClass()Getting theClassof the value this computable produces.static <K,V>
IComputable<K,V>of(java.lang.Class<? super V> valueClass, java.util.function.Function<K,V> function)Creates a newIComputablefor the given value class using the givenFunctionto compute the values from keys.
-
-
-
Method Detail
-
compute
V compute(K key) throws java.lang.InterruptedException
Compute an object of type V identified by the key of type K- Parameters:
key- the key to identify the object- Returns:
- the computed Object of type V
- Throws:
java.lang.InterruptedException- When computation was interrupted
-
getValueClass
java.lang.Class<? super V> getValueClass()
Getting theClassof the value this computable produces.
-
of
static <K,V> IComputable<K,V> of(java.lang.Class<? super V> valueClass, java.util.function.Function<K,V> function)
Creates a newIComputablefor the given value class using the givenFunctionto compute the values from keys.- Type Parameters:
K- the key typeV- the value type- Parameters:
valueClass- the class of the valuesfunction- the function to compute a value from a key- Returns:
- a new
IComputable
-
-