org.op4j.functions
Class MapBuilder<T,K,V>
Object
org.op4j.functions.Function<T,Map.Entry<K,V>>
org.op4j.functions.MapBuilder<T,K,V>
- All Implemented Interfaces:
- IFunction<T,Map.Entry<K,V>>
public abstract class MapBuilder<T,K,V>
- extends Function<T,Map.Entry<K,V>>
Base abstract implementation of IFunction
aimed at map building, which
substitutes the execute(...) method by two more easily implementable
buildKey(Object)
and buildValue(Object)
, creating map entries
from the results of these two methods.
- Since:
- 1.0
- Author:
- Daniel Fernández
Methods inherited from class Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MapBuilder
protected MapBuilder()
buildKey
public abstract K buildKey(T target)
buildValue
public abstract V buildValue(T target)
execute
public final Map.Entry<K,V> execute(T input,
ExecCtx ctx)
throws Exception
- Description copied from interface:
IFunction
Executes the function on the current target object, which is passed
as the input parameter. The ExecCtx
parameter
provides some metadata related to the execution, like the index in
an iteration.
The execution of a function can throw any exception.
If you intend to call the execute method directly on any of
your functions (outside an op4j expression), you might prefer using
Function.execute(Object)
instead.
- Parameters:
input
- the target object on which the function is to be executedctx
- the context (metadata) for the function execution
- Returns:
- the result of executing the function
- Throws:
Exception
Copyright © 2012 The OP4J team. All Rights Reserved.