|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.staccatocommons.lambda.LambdaFactory
public final class LambdaFactory
LambdaFactorys are objects capable of creating simple
Functions and Predicates of different arities in a DSL style,
instead of implementing anonymous classes.
| Constructor Summary | |
|---|---|
LambdaFactory(org.apache.commons.proxy.ProxyFactory proxyFactory)
Creates a new LambdaFactory |
|
| Method Summary | ||
|---|---|---|
|
$(Class<A> clazz)
Stubs a type for creating a lambda. |
|
|
lambda(B returnType)
Answers a Function that when applied sends to its argument the
message previously sent to the last stubbed type. |
|
|
lambda(boolean returnType)
Answers a Predicate that when evaluated sends to its argument the
message previously sent to the last stubbed type. |
|
|
lambda2(boolean returnType)
|
|
|
lambda2(C returnType)
|
|
|
lambda3(D returnType)
Answers a Function3 that when applied sends to its first argument
the message previously sent to the last stubbed type, passing its second
argument as the first message argument, and its third argument to the
second message argument. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public LambdaFactory(@NonNull
org.apache.commons.proxy.ProxyFactory proxyFactory)
LambdaFactory
| Method Detail |
|---|
@NonNull
public <A> A $(@NonNull
Class<A> clazz)
LambdaFactorys can stub all types - ie, stubbing
interfaces, concrete classes or final classes. Their stubbing capabilities
depend on the ProxyFactory passed as constructor argument to this
LambdaFactory
A - clazz - the type to stub
@NonNull public <A> net.sf.staccatocommons.defs.predicate.Predicate<A> lambda(boolean returnType)
Predicate that when evaluated sends to its argument the
message previously sent to the last stubbed type. Refer to the use cases
described in Lambda
returnType - meaningless, this argument is simply ignored
AbstractPredicateLambda@NonNull public <A,B> net.sf.staccatocommons.defs.function.Function<A,B> lambda(B returnType)
Function that when applied sends to its argument the
message previously sent to the last stubbed type. Refer to the use cases
described in Lambda
returnType - meaningless, this argument is simply ignored
FunctionLambda@NonNull public <A,B,C> net.sf.staccatocommons.defs.function.Function2<A,B,C> lambda2(C returnType)
@NonNull public <A,B> net.sf.staccatocommons.defs.predicate.Predicate2<A,B> lambda2(boolean returnType)
Lambda.lambda2(boolean)public <A,B,C,D> net.sf.staccatocommons.defs.function.Function3<A,B,C,D> lambda3(D returnType)
Function3 that when applied sends to its first argument
the message previously sent to the last stubbed type, passing its second
argument as the first message argument, and its third argument to the
second message argument.
Refer to the use cases described in Lambda
returnType - meaningless, this argument is simply ignored
Function3Lambda
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||