TParam
- Type of the input parameter.TCached
- Type of the (cached) output value. Recommended to be immutable.public class SingleEntryCache<TParam,TCached> extends Object
Function
that only caches the most recently used parameter. Parameter equality is
checked via Object.equals(Object)
. Useful for backing beans used in views that keep accessing a property
while building the view via c:choose
etc. Constructor and Description |
---|
SingleEntryCache(Function<TParam,TCached> function) |
SingleEntryCache(Function<TParam,TCached> function,
BiPredicate<TParam,TParam> comparator) |
SingleEntryCache(Function<TParam,TCached> function,
BiPredicate<TParam,TParam> comparator,
boolean supportsNull) |
public SingleEntryCache(Function<TParam,TCached> function)
function
- Function that computes the (cached) value from the input. Must be deterministic, ie. the output
must depend only on the input.public SingleEntryCache(Function<TParam,TCached> function, BiPredicate<TParam,TParam> comparator)
function
- Function that computes the (cached) value from the input. Must be deterministic, ie. the output
must depend only on the input.public SingleEntryCache(Function<TParam,TCached> function, BiPredicate<TParam,TParam> comparator, boolean supportsNull)
function
- Function that computes the (cached) value from the input. Must be deterministic, ie. the output
must depend only on the input.comparator
- Custom comparator that check whether two parameter keys are equal. By default, Object.equals(Object)
is used.supportsNull
- Whether the passed function supports null
as input.Copyright © 2019 XIMA MEDIA GmbH. All rights reserved.