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.
|
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()
ReadFunction
readValue
in interface ReadFunction<T>
public void writeValue(T newValue)
WriteFunction
writeValue
in interface WriteFunction<T>
newValue
- a valuepublic Class<T> getType()
ValueCache
getType
in interface ValueCache<T>
Copyright © 2010–2015. All rights reserved.