RxJava



rx.util.functions
Class Functions

java.lang.Object
  extended by rx.util.functions.Functions

public class Functions
extends java.lang.Object

Allows execution of functions from multiple different languages.

Language support is provided via implementations of FunctionLanguageAdaptor.

This class will dynamically look for known language adaptors on the classpath at startup or new ones can be registered using #registerLanguageAdaptor(Class, FunctionLanguageAdaptor).


Constructor Summary
Functions()
           
 
Method Summary
static FuncN from(java.lang.Object function)
          Utility method for determining the type of closure/function and executing it.
static FuncN<java.lang.Void> fromAction(Action0 f)
          Convert a function to FuncN to allow heterogeneous handling of functions with different arities.
static
<T0> FuncN<java.lang.Void>
fromAction(Action1<T0> f)
          Convert a function to FuncN to allow heterogeneous handling of functions with different arities.
static
<T0,T1> FuncN<java.lang.Void>
fromAction(Action2<T0,T1> f)
          Convert a function to FuncN to allow heterogeneous handling of functions with different arities.
static
<T0,T1,T2> FuncN<java.lang.Void>
fromAction(Action3<T0,T1,T2> f)
          Convert a function to FuncN to allow heterogeneous handling of functions with different arities.
static
<R> FuncN<R>
fromFunc(Func0<R> f)
          Convert a function to FuncN to allow heterogeneous handling of functions with different arities.
static
<T0,R> FuncN<R>
fromFunc(Func1<T0,R> f)
          Convert a function to FuncN to allow heterogeneous handling of functions with different arities.
static
<T0,T1,R> FuncN<R>
fromFunc(Func2<T0,T1,R> f)
          Convert a function to FuncN to allow heterogeneous handling of functions with different arities.
static
<T0,T1,T2,R>
FuncN<R>
fromFunc(Func3<T0,T1,T2,R> f)
          Convert a function to FuncN to allow heterogeneous handling of functions with different arities.
static
<T0,T1,T2,T3,R>
FuncN<R>
fromFunc(Func4<T0,T1,T2,T3,R> f)
          Convert a function to FuncN to allow heterogeneous handling of functions with different arities.
static
<T0,T1,T2,T3,T4,R>
FuncN<R>
fromFunc(Func5<T0,T1,T2,T3,T4,R> f)
          Convert a function to FuncN to allow heterogeneous handling of functions with different arities.
static
<T0,T1,T2,T3,T4,T5,R>
FuncN<R>
fromFunc(Func6<T0,T1,T2,T3,T4,T5,R> f)
          Convert a function to FuncN to allow heterogeneous handling of functions with different arities.
static
<T0,T1,T2,T3,T4,T5,T6,R>
FuncN<R>
fromFunc(Func7<T0,T1,T2,T3,T4,T5,T6,R> f)
          Convert a function to FuncN to allow heterogeneous handling of functions with different arities.
static
<T0,T1,T2,T3,T4,T5,T6,T7,R>
FuncN<R>
fromFunc(Func8<T0,T1,T2,T3,T4,T5,T6,T7,R> f)
          Convert a function to FuncN to allow heterogeneous handling of functions with different arities.
static
<T0,T1,T2,T3,T4,T5,T6,T7,T8,R>
FuncN<R>
fromFunc(Func9<T0,T1,T2,T3,T4,T5,T6,T7,T8,R> f)
          Convert a function to FuncN to allow heterogeneous handling of functions with different arities.
static java.util.Collection<FunctionLanguageAdaptor> getRegisteredLanguageAdaptors()
           
static void registerLanguageAdaptor(java.lang.Class<?>[] functionClasses, FunctionLanguageAdaptor adaptor)
           
static void removeLanguageAdaptor(java.lang.Class<?> functionClass)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Functions

public Functions()
Method Detail

registerLanguageAdaptor

public static void registerLanguageAdaptor(java.lang.Class<?>[] functionClasses,
                                           FunctionLanguageAdaptor adaptor)

removeLanguageAdaptor

public static void removeLanguageAdaptor(java.lang.Class<?> functionClass)

getRegisteredLanguageAdaptors

public static java.util.Collection<FunctionLanguageAdaptor> getRegisteredLanguageAdaptors()

from

public static FuncN from(java.lang.Object function)
Utility method for determining the type of closure/function and executing it.

Parameters:
function -
args -

fromFunc

public static <R> FuncN<R> fromFunc(Func0<R> f)
Convert a function to FuncN to allow heterogeneous handling of functions with different arities.

Parameters:
f -
Returns:
FuncN

fromFunc

public static <T0,R> FuncN<R> fromFunc(Func1<T0,R> f)
Convert a function to FuncN to allow heterogeneous handling of functions with different arities.

Parameters:
f -
Returns:
FuncN

fromFunc

public static <T0,T1,R> FuncN<R> fromFunc(Func2<T0,T1,R> f)
Convert a function to FuncN to allow heterogeneous handling of functions with different arities.

Parameters:
f -
Returns:
FuncN

fromFunc

public static <T0,T1,T2,R> FuncN<R> fromFunc(Func3<T0,T1,T2,R> f)
Convert a function to FuncN to allow heterogeneous handling of functions with different arities.

Parameters:
f -
Returns:
FuncN

fromFunc

public static <T0,T1,T2,T3,R> FuncN<R> fromFunc(Func4<T0,T1,T2,T3,R> f)
Convert a function to FuncN to allow heterogeneous handling of functions with different arities.

Parameters:
f -
Returns:
FuncN

fromFunc

public static <T0,T1,T2,T3,T4,R> FuncN<R> fromFunc(Func5<T0,T1,T2,T3,T4,R> f)
Convert a function to FuncN to allow heterogeneous handling of functions with different arities.

Parameters:
f -
Returns:
FuncN

fromFunc

public static <T0,T1,T2,T3,T4,T5,R> FuncN<R> fromFunc(Func6<T0,T1,T2,T3,T4,T5,R> f)
Convert a function to FuncN to allow heterogeneous handling of functions with different arities.

Parameters:
f -
Returns:
FuncN

fromFunc

public static <T0,T1,T2,T3,T4,T5,T6,R> FuncN<R> fromFunc(Func7<T0,T1,T2,T3,T4,T5,T6,R> f)
Convert a function to FuncN to allow heterogeneous handling of functions with different arities.

Parameters:
f -
Returns:
FuncN

fromFunc

public static <T0,T1,T2,T3,T4,T5,T6,T7,R> FuncN<R> fromFunc(Func8<T0,T1,T2,T3,T4,T5,T6,T7,R> f)
Convert a function to FuncN to allow heterogeneous handling of functions with different arities.

Parameters:
f -
Returns:
FuncN

fromFunc

public static <T0,T1,T2,T3,T4,T5,T6,T7,T8,R> FuncN<R> fromFunc(Func9<T0,T1,T2,T3,T4,T5,T6,T7,T8,R> f)
Convert a function to FuncN to allow heterogeneous handling of functions with different arities.

Parameters:
f -
Returns:
FuncN

fromAction

public static FuncN<java.lang.Void> fromAction(Action0 f)
Convert a function to FuncN to allow heterogeneous handling of functions with different arities.

Parameters:
f -
Returns:
FuncN

fromAction

public static <T0> FuncN<java.lang.Void> fromAction(Action1<T0> f)
Convert a function to FuncN to allow heterogeneous handling of functions with different arities.

Parameters:
f -
Returns:
FuncN

fromAction

public static <T0,T1> FuncN<java.lang.Void> fromAction(Action2<T0,T1> f)
Convert a function to FuncN to allow heterogeneous handling of functions with different arities.

Parameters:
f -
Returns:
FuncN

fromAction

public static <T0,T1,T2> FuncN<java.lang.Void> fromAction(Action3<T0,T1,T2> f)
Convert a function to FuncN to allow heterogeneous handling of functions with different arities.

Parameters:
f -
Returns:
FuncN