T - type to cacheR - type to forward when the cache changespublic class ForwardCache<T,R> extends Object implements ValueCache<T>
This can be used to connect a function of multiple values to a single collector.
| Constructor and Description |
|---|
ForwardCache(ValueCache<T> valueCache,
ReadFunction<R> forwardFunction,
WriteFunction<R> forwardWriter)
Creates a new ForwardCache.
|
| Modifier and Type | Method and Description |
|---|---|
Class<T> |
getType()
The type of objects that this cache can contain.
|
T |
readValue()
Calculates, if needed, and then returns the value for this function.
|
void |
writeValue(T newValue)
Takes the value and consumes it.
|
public ForwardCache(ValueCache<T> valueCache, ReadFunction<R> forwardFunction, WriteFunction<R> forwardWriter)
valueCache - the cache that will hold the valueforwardFunction - the function that calculates the value to forwardforwardWriter - the destination of the calculated valuepublic T readValue()
ReadFunctionreadValue in interface ReadFunction<T>public void writeValue(T newValue)
WriteFunctionwriteValue in interface WriteFunction<T>newValue - a valuepublic Class<T> getType()
ValueCachegetType in interface ValueCache<T>Copyright © 2015. All rights reserved.