|
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectuk.co.jezuk.mango.Adapt
public class Adapt
The Mango Library Object Adaptors
Provides methods to adapt instance and static methods into
Functions.
Bind| Method Summary | ||
|---|---|---|
static Function |
ArgumentMethod(java.lang.String methodName)
Creates a Function which will call a method on the
object passed as the argument to Function.fn method. |
|
static
|
ArgumentMethod(java.lang.String methodName,
java.lang.Class<T> argType)
|
|
static
|
ArgumentMethod(java.lang.String methodName,
java.lang.Class<T> argType,
java.lang.Class<R> returnType)
|
|
static Function |
Method(java.lang.Class klass,
java.lang.String methodName)
Adapts static member functions as Function objects, allowing them
to be passed to algorithms. |
|
static
|
Method(java.lang.Class klass,
java.lang.String methodName,
java.lang.Class<T> argType)
|
|
static
|
Method(java.lang.Class klass,
java.lang.String methodName,
java.lang.Class<T> argType,
java.lang.Class<R> returnType)
|
|
static Function |
Method(java.lang.Object obj,
java.lang.String methodName)
Adapts member functions as Function objects, allowing them
to be passed to algorithms. |
|
static
|
Method(java.lang.Object obj,
java.lang.String methodName,
java.lang.Class<T> argType)
|
|
static
|
Method(java.lang.Object obj,
java.lang.String methodName,
java.lang.Class<T> argType,
java.lang.Class<R> returnType)
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static Function Method(java.lang.Object obj,
java.lang.String methodName)
Function objects, allowing them
to be passed to algorithms.
Mango.forEach(list, Adapt.Method(System.out, "println"));for(int i = 0; i < list.size(); ++i) System.out.println(list.get(i));
If the named method is not found, or its signature is incorrect throws a RuntimeException. If multiple methods have the correct name, and take a single parameter one of them will be called, but you can't determine which.
public static <T,Void> Function<T,Void> Method(java.lang.Object obj,
java.lang.String methodName,
java.lang.Class<T> argType)
public static <T,R> Function<T,R> Method(java.lang.Object obj,
java.lang.String methodName,
java.lang.Class<T> argType,
java.lang.Class<R> returnType)
public static Function Method(java.lang.Class klass,
java.lang.String methodName)
Function objects, allowing them
to be passed to algorithms.
If the named method is not found, or its signature is incorrect throws a RuntimeException. If multiple methods have the correct name, and take a single parameter one of them will be called, but you can't determine which.
public static <T,Void> Function<T,Void> Method(java.lang.Class klass,
java.lang.String methodName,
java.lang.Class<T> argType)
public static <T,R> Function<T,R> Method(java.lang.Class klass,
java.lang.String methodName,
java.lang.Class<T> argType,
java.lang.Class<R> returnType)
public static Function ArgumentMethod(java.lang.String methodName)
Function which will call a method on the
object passed as the argument to Function.fn method.
interface Something { void persist(); }
// fill list with Somethings
Mango.forEach(list, Bind.ArgumentMethod("persist"));for(int i = 0; i < list.size(); ++i)
{
Something s = (Something)list.get(i);
s.persist();
}
If the named method is not found, or its signature is incorrect throws a RuntimeException.
Function
public static <T,Void> Function<T,Void> ArgumentMethod(java.lang.String methodName,
java.lang.Class<T> argType)
public static <T,R> Function<T,R> ArgumentMethod(java.lang.String methodName,
java.lang.Class<T> argType,
java.lang.Class<R> returnType)
|
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||