org.op4j.functions
Class Call<T,R>

Object
  extended by org.op4j.functions.Function<T,R>
      extended by org.op4j.functions.Call<T,R>
All Implemented Interfaces:
IFunction<T,R>

public final class Call<T,R>
extends Function<T,R>

Function hub class for executing methods of target objects.

Since:
1.0
Author:
Daniel Fernández

Method Summary
static
<R> Function<Object,R[]>
arrayOf(org.javaruntype.type.Type<R> resultType, String methodName, Object... optionalParameters)
           Abbreviation for {methodForArrayOf(Type, String, Object...).
static Function<Object,String[]> arrayOfString(String methodName, Object... optionalParameters)
           Abbreviation for {methodForArrayOfString(String, Object...).
static Function<Object,Byte> b(String methodName, Object... optionalParameters)
           Abbreviation for {methodForByte(String, Object...).
static Function<Object,BigDecimal> bigDecimal(String methodName, Object... optionalParameters)
           Abbreviation for {methodForBigDecimal(String, Object...).
static Function<Object,BigInteger> bigInteger(String methodName, Object... optionalParameters)
           Abbreviation for {methodForBigInteger(String, Object...).
static Function<Object,Boolean> bool(String methodName, Object... optionalParameters)
           Abbreviation for {methodForBoolean(String, Object...).
static Function<Object,Character> c(String methodName, Object... optionalParameters)
           Abbreviation for {methodForCharacter(String, Object...).
static Function<Object,Calendar> calendar(String methodName, Object... optionalParameters)
           Abbreviation for {methodForCalendar(String, Object...).
static Function<Object,Double> d(String methodName, Object... optionalParameters)
           Abbreviation for {methodForDouble(String, Object...).
static Function<Object,Date> date(String methodName, Object... optionalParameters)
           Abbreviation for {methodForDate(String, Object...).
 R execute(T input, ExecCtx ctx)
           Executes the function on the current target object, which is passed as the input parameter.
static Function<Object,Float> f(String methodName, Object... optionalParameters)
           Abbreviation for {methodForFloat(String, Object...).
static Function<Object,Integer> i(String methodName, Object... optionalParameters)
           Abbreviation for {methodForInteger(String, Object...).
static Function<Object,Long> l(String methodName, Object... optionalParameters)
           Abbreviation for {methodForLong(String, Object...).
static
<R> Function<Object,List<R>>
listOf(org.javaruntype.type.Type<R> resultType, String methodName, Object... optionalParameters)
           Abbreviation for {methodForListOf(Type, String, Object...).
static Function<Object,List<String>> listOfString(String methodName, Object... optionalParameters)
           Abbreviation for {methodForListOfString(String, Object...).
static
<R> Function<Object,R>
methodFor(org.javaruntype.type.Type<R> resultType, String methodName, Object... optionalParameters)
           Executes a method on the target object which returns an object of the resultType.
static
<R> Function<Object,R[]>
methodForArrayOf(org.javaruntype.type.Type<R> resultType, String methodName, Object... optionalParameters)
           Executes a method on the target object which returns R[], being R the specified type parameter.
static Function<Object,String[]> methodForArrayOfString(String methodName, Object... optionalParameters)
           Executes a method on the target object which returns String[].
static Function<Object,BigDecimal> methodForBigDecimal(String methodName, Object... optionalParameters)
           Executes a method on the target object which returns BigDecimal.
static Function<Object,BigInteger> methodForBigInteger(String methodName, Object... optionalParameters)
           Executes a method on the target object which returns BigInteger.
static Function<Object,Boolean> methodForBoolean(String methodName, Object... optionalParameters)
           Executes a method on the target object which returns Boolean.
static Function<Object,Byte> methodForByte(String methodName, Object... optionalParameters)
           Executes a method on the target object which returns Byte.
static Function<Object,Calendar> methodForCalendar(String methodName, Object... optionalParameters)
           Executes a method on the target object which returns Calendar.
static Function<Object,Character> methodForCharacter(String methodName, Object... optionalParameters)
           Executes a method on the target object which returns Character.
static Function<Object,Date> methodForDate(String methodName, Object... optionalParameters)
           Executes a method on the target object which returns Date.
static Function<Object,Double> methodForDouble(String methodName, Object... optionalParameters)
           Executes a method on the target object which returns Double.
static Function<Object,Float> methodForFloat(String methodName, Object... optionalParameters)
           Executes a method on the target object which returns Float.
static Function<Object,Integer> methodForInteger(String methodName, Object... optionalParameters)
           Executes a method on the target object which returns Integer.
static
<R> Function<Object,List<R>>
methodForListOf(org.javaruntype.type.Type<R> resultType, String methodName, Object... optionalParameters)
           Executes a method on the target object which returns List<R>, being R the specified type parameter.
static Function<Object,List<String>> methodForListOfString(String methodName, Object... optionalParameters)
           Executes a method on the target object which returns List<String>.
static Function<Object,Long> methodForLong(String methodName, Object... optionalParameters)
           Executes a method on the target object which returns Long.
static Function<Object,Object> methodForObject(String methodName, Object... optionalParameters)
           Executes a method on the target object which returns Object.
static
<R> Function<Object,Set<R>>
methodForSetOf(org.javaruntype.type.Type<R> resultType, String methodName, Object... optionalParameters)
           Executes a method on the target object which returns Set<R>, being R the specified type parameter.
static Function<Object,Set<String>> methodForSetOfString(String methodName, Object... optionalParameters)
           Executes a method on the target object which returns Set<String>.
static Function<Object,Short> methodForShort(String methodName, Object... optionalParameters)
           Executes a method on the target object which returns Short.
static Function<Object,String> methodForString(String methodName, Object... optionalParameters)
           Executes a method on the target object which returns String.
static Function<Object,Object> obj(String methodName, Object... optionalParameters)
           Abbreviation for {methodForObject(String, Object...).
static
<R> Function<Object,R>
obj(org.javaruntype.type.Type<R> resultType, String methodName, Object... optionalParameters)
           Abbreviation for {methodFor(Type, String, Object...).
static Function<Object,String> s(String methodName, Object... optionalParameters)
           Abbreviation for {methodForString(String, Object...).
static
<R> Function<Object,Set<R>>
setOf(org.javaruntype.type.Type<R> resultType, String methodName, Object... optionalParameters)
           Abbreviation for {methodForSetOf(Type, String, Object...).
static Function<Object,Set<String>> setOfString(String methodName, Object... optionalParameters)
           Abbreviation for {methodForSetOfString(String, Object...).
static Function<Object,Short> shr(String methodName, Object... optionalParameters)
           Abbreviation for {methodForShort(String, Object...).
 
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
 

Method Detail

methodForObject

public static Function<Object,Object> methodForObject(String methodName,
                                                      Object... optionalParameters)

Executes a method on the target object which returns Object. Parameters must match those of the method.

Parameters:
methodName - the name of the method
optionalParameters - the (optional) parameters of the method.
Returns:
the result of the method execution

obj

public static Function<Object,Object> obj(String methodName,
                                          Object... optionalParameters)

Abbreviation for {methodForObject(String, Object...).

Parameters:
methodName - the name of the method
optionalParameters - the (optional) parameters of the method.
Returns:
the result of the method execution
Since:
1.1

methodFor

public static <R> Function<Object,R> methodFor(org.javaruntype.type.Type<R> resultType,
                                               String methodName,
                                               Object... optionalParameters)

Executes a method on the target object which returns an object of the resultType. Parameters must match those of the method.

Parameters:
resultType - the type of the result
methodName - the name of the method
optionalParameters - the (optional) parameters of the method.
Returns:
the result of the method execution

obj

public static <R> Function<Object,R> obj(org.javaruntype.type.Type<R> resultType,
                                         String methodName,
                                         Object... optionalParameters)

Abbreviation for {methodFor(Type, String, Object...).

Parameters:
resultType - the type of the result
methodName - the name of the method
optionalParameters - the (optional) parameters of the method.
Returns:
the result of the method execution
Since:
1.1

methodForBigInteger

public static Function<Object,BigInteger> methodForBigInteger(String methodName,
                                                              Object... optionalParameters)

Executes a method on the target object which returns BigInteger. Parameters must match those of the method.

Parameters:
methodName - the name of the method
optionalParameters - the (optional) parameters of the method.
Returns:
the result of the method execution

bigInteger

public static Function<Object,BigInteger> bigInteger(String methodName,
                                                     Object... optionalParameters)

Abbreviation for {methodForBigInteger(String, Object...).

Parameters:
methodName - the name of the method
optionalParameters - the (optional) parameters of the method.
Returns:
the result of the method execution
Since:
1.1

methodForBigDecimal

public static Function<Object,BigDecimal> methodForBigDecimal(String methodName,
                                                              Object... optionalParameters)

Executes a method on the target object which returns BigDecimal. Parameters must match those of the method.

Parameters:
methodName - the name of the method
optionalParameters - the (optional) parameters of the method.
Returns:
the result of the method execution

bigDecimal

public static Function<Object,BigDecimal> bigDecimal(String methodName,
                                                     Object... optionalParameters)

Abbreviation for {methodForBigDecimal(String, Object...).

Parameters:
methodName - the name of the method
optionalParameters - the (optional) parameters of the method.
Returns:
the result of the method execution
Since:
1.1

methodForBoolean

public static Function<Object,Boolean> methodForBoolean(String methodName,
                                                        Object... optionalParameters)

Executes a method on the target object which returns Boolean. Parameters must match those of the method.

Parameters:
methodName - the name of the method
optionalParameters - the (optional) parameters of the method.
Returns:
the result of the method execution

bool

public static Function<Object,Boolean> bool(String methodName,
                                            Object... optionalParameters)

Abbreviation for {methodForBoolean(String, Object...).

Parameters:
methodName - the name of the method
optionalParameters - the (optional) parameters of the method.
Returns:
the result of the method execution
Since:
1.1

methodForByte

public static Function<Object,Byte> methodForByte(String methodName,
                                                  Object... optionalParameters)

Executes a method on the target object which returns Byte. Parameters must match those of the method.

Parameters:
methodName - the name of the method
optionalParameters - the (optional) parameters of the method.
Returns:
the result of the method execution

b

public static Function<Object,Byte> b(String methodName,
                                      Object... optionalParameters)

Abbreviation for {methodForByte(String, Object...).

Parameters:
methodName - the name of the method
optionalParameters - the (optional) parameters of the method.
Returns:
the result of the method execution
Since:
1.1

methodForCharacter

public static Function<Object,Character> methodForCharacter(String methodName,
                                                            Object... optionalParameters)

Executes a method on the target object which returns Character. Parameters must match those of the method.

Parameters:
methodName - the name of the method
optionalParameters - the (optional) parameters of the method.
Returns:
the result of the method execution

c

public static Function<Object,Character> c(String methodName,
                                           Object... optionalParameters)

Abbreviation for {methodForCharacter(String, Object...).

Parameters:
methodName - the name of the method
optionalParameters - the (optional) parameters of the method.
Returns:
the result of the method execution
Since:
1.1

methodForCalendar

public static Function<Object,Calendar> methodForCalendar(String methodName,
                                                          Object... optionalParameters)

Executes a method on the target object which returns Calendar. Parameters must match those of the method.

Parameters:
methodName - the name of the method
optionalParameters - the (optional) parameters of the method.
Returns:
the result of the method execution

calendar

public static Function<Object,Calendar> calendar(String methodName,
                                                 Object... optionalParameters)

Abbreviation for {methodForCalendar(String, Object...).

Parameters:
methodName - the name of the method
optionalParameters - the (optional) parameters of the method.
Returns:
the result of the method execution
Since:
1.1

methodForDate

public static Function<Object,Date> methodForDate(String methodName,
                                                  Object... optionalParameters)

Executes a method on the target object which returns Date. Parameters must match those of the method.

Parameters:
methodName - the name of the method
optionalParameters - the (optional) parameters of the method.
Returns:
the result of the method execution

date

public static Function<Object,Date> date(String methodName,
                                         Object... optionalParameters)

Abbreviation for {methodForDate(String, Object...).

Parameters:
methodName - the name of the method
optionalParameters - the (optional) parameters of the method.
Returns:
the result of the method execution
Since:
1.1

methodForDouble

public static Function<Object,Double> methodForDouble(String methodName,
                                                      Object... optionalParameters)

Executes a method on the target object which returns Double. Parameters must match those of the method.

Parameters:
methodName - the name of the method
optionalParameters - the (optional) parameters of the method.
Returns:
the result of the method execution

d

public static Function<Object,Double> d(String methodName,
                                        Object... optionalParameters)

Abbreviation for {methodForDouble(String, Object...).

Parameters:
methodName - the name of the method
optionalParameters - the (optional) parameters of the method.
Returns:
the result of the method execution
Since:
1.1

methodForFloat

public static Function<Object,Float> methodForFloat(String methodName,
                                                    Object... optionalParameters)

Executes a method on the target object which returns Float. Parameters must match those of the method.

Parameters:
methodName - the name of the method
optionalParameters - the (optional) parameters of the method.
Returns:
the result of the method execution

f

public static Function<Object,Float> f(String methodName,
                                       Object... optionalParameters)

Abbreviation for {methodForFloat(String, Object...).

Parameters:
methodName - the name of the method
optionalParameters - the (optional) parameters of the method.
Returns:
the result of the method execution
Since:
1.1

methodForInteger

public static Function<Object,Integer> methodForInteger(String methodName,
                                                        Object... optionalParameters)

Executes a method on the target object which returns Integer. Parameters must match those of the method.

Parameters:
methodName - the name of the method
optionalParameters - the (optional) parameters of the method.
Returns:
the result of the method execution

i

public static Function<Object,Integer> i(String methodName,
                                         Object... optionalParameters)

Abbreviation for {methodForInteger(String, Object...).

Parameters:
methodName - the name of the method
optionalParameters - the (optional) parameters of the method.
Returns:
the result of the method execution
Since:
1.1

methodForLong

public static Function<Object,Long> methodForLong(String methodName,
                                                  Object... optionalParameters)

Executes a method on the target object which returns Long. Parameters must match those of the method.

Parameters:
methodName - the name of the method
optionalParameters - the (optional) parameters of the method.
Returns:
the result of the method execution

l

public static Function<Object,Long> l(String methodName,
                                      Object... optionalParameters)

Abbreviation for {methodForLong(String, Object...).

Parameters:
methodName - the name of the method
optionalParameters - the (optional) parameters of the method.
Returns:
the result of the method execution
Since:
1.1

methodForShort

public static Function<Object,Short> methodForShort(String methodName,
                                                    Object... optionalParameters)

Executes a method on the target object which returns Short. Parameters must match those of the method.

Parameters:
methodName - the name of the method
optionalParameters - the (optional) parameters of the method.
Returns:
the result of the method execution

shr

public static Function<Object,Short> shr(String methodName,
                                         Object... optionalParameters)

Abbreviation for {methodForShort(String, Object...).

Parameters:
methodName - the name of the method
optionalParameters - the (optional) parameters of the method.
Returns:
the result of the method execution
Since:
1.1

methodForString

public static Function<Object,String> methodForString(String methodName,
                                                      Object... optionalParameters)

Executes a method on the target object which returns String. Parameters must match those of the method.

Parameters:
methodName - the name of the method
optionalParameters - the (optional) parameters of the method.
Returns:
the result of the method execution

s

public static Function<Object,String> s(String methodName,
                                        Object... optionalParameters)

Abbreviation for {methodForString(String, Object...).

Parameters:
methodName - the name of the method
optionalParameters - the (optional) parameters of the method.
Returns:
the result of the method execution
Since:
1.1

methodForListOfString

public static Function<Object,List<String>> methodForListOfString(String methodName,
                                                                  Object... optionalParameters)

Executes a method on the target object which returns List<String>. Parameters must match those of the method.

Parameters:
methodName - the name of the method
optionalParameters - the (optional) parameters of the method.
Returns:
the result of the method execution

listOfString

public static Function<Object,List<String>> listOfString(String methodName,
                                                         Object... optionalParameters)

Abbreviation for {methodForListOfString(String, Object...).

Parameters:
methodName - the name of the method
optionalParameters - the (optional) parameters of the method.
Returns:
the result of the method execution
Since:
1.1

methodForSetOfString

public static Function<Object,Set<String>> methodForSetOfString(String methodName,
                                                                Object... optionalParameters)

Executes a method on the target object which returns Set<String>. Parameters must match those of the method.

Parameters:
methodName - the name of the method
optionalParameters - the (optional) parameters of the method.
Returns:
the result of the method execution

setOfString

public static Function<Object,Set<String>> setOfString(String methodName,
                                                       Object... optionalParameters)

Abbreviation for {methodForSetOfString(String, Object...).

Parameters:
methodName - the name of the method
optionalParameters - the (optional) parameters of the method.
Returns:
the result of the method execution
Since:
1.1

methodForArrayOfString

public static Function<Object,String[]> methodForArrayOfString(String methodName,
                                                               Object... optionalParameters)

Executes a method on the target object which returns String[]. Parameters must match those of the method.

Parameters:
methodName - the name of the method
optionalParameters - the (optional) parameters of the method.
Returns:
the result of the method execution

arrayOfString

public static Function<Object,String[]> arrayOfString(String methodName,
                                                      Object... optionalParameters)

Abbreviation for {methodForArrayOfString(String, Object...).

Parameters:
methodName - the name of the method
optionalParameters - the (optional) parameters of the method.
Returns:
the result of the method execution
Since:
1.1

methodForListOf

public static <R> Function<Object,List<R>> methodForListOf(org.javaruntype.type.Type<R> resultType,
                                                           String methodName,
                                                           Object... optionalParameters)

Executes a method on the target object which returns List<R>, being R the specified type parameter. Parameters must match those of the method.

Parameters:
resultType - the type of the method's result
methodName - the name of the method
optionalParameters - the (optional) parameters of the method.
Returns:
the result of the method execution

listOf

public static <R> Function<Object,List<R>> listOf(org.javaruntype.type.Type<R> resultType,
                                                  String methodName,
                                                  Object... optionalParameters)

Abbreviation for {methodForListOf(Type, String, Object...).

Parameters:
methodName - the name of the method
optionalParameters - the (optional) parameters of the method.
Returns:
the result of the method execution
Since:
1.1

methodForSetOf

public static <R> Function<Object,Set<R>> methodForSetOf(org.javaruntype.type.Type<R> resultType,
                                                         String methodName,
                                                         Object... optionalParameters)

Executes a method on the target object which returns Set<R>, being R the specified type parameter. Parameters must match those of the method.

Parameters:
resultType - the type of the method's result
methodName - the name of the method
optionalParameters - the (optional) parameters of the method.
Returns:
the result of the method execution

setOf

public static <R> Function<Object,Set<R>> setOf(org.javaruntype.type.Type<R> resultType,
                                                String methodName,
                                                Object... optionalParameters)

Abbreviation for {methodForSetOf(Type, String, Object...).

Parameters:
methodName - the name of the method
optionalParameters - the (optional) parameters of the method.
Returns:
the result of the method execution
Since:
1.1

methodForArrayOf

public static <R> Function<Object,R[]> methodForArrayOf(org.javaruntype.type.Type<R> resultType,
                                                        String methodName,
                                                        Object... optionalParameters)

Executes a method on the target object which returns R[], being R the specified type parameter. Parameters must match those of the method.

Parameters:
resultType - the type of the method's result
methodName - the name of the method
optionalParameters - the (optional) parameters of the method.
Returns:
the result of the method execution

arrayOf

public static <R> Function<Object,R[]> arrayOf(org.javaruntype.type.Type<R> resultType,
                                               String methodName,
                                               Object... optionalParameters)

Abbreviation for {methodForArrayOf(Type, String, Object...).

Parameters:
methodName - the name of the method
optionalParameters - the (optional) parameters of the method.
Returns:
the result of the method execution
Since:
1.1

execute

public R 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.