org.op4j.functions
Class MapBuilder<T,K,V>

Object
  extended by org.op4j.functions.Function<T,Map.Entry<K,V>>
      extended by 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

Constructor Summary
protected MapBuilder()
           
 
Method Summary
abstract  K buildKey(T target)
           
abstract  V buildValue(T target)
           
 Map.Entry<K,V> execute(T input, ExecCtx ctx)
           Executes the function on the current target object, which is passed as the input parameter.
 
Methods inherited from class org.op4j.functions.Function
execute
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MapBuilder

protected MapBuilder()
Method Detail

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 executed
ctx - the context (metadata) for the function execution
Returns:
the result of executing the function
Throws:
Exception


Copyright © 2012 The OP4J team. All Rights Reserved.