public class JLambda extends Object implements IJExpression
(a, b) -> a + b
"a" and "b"
are parameters and "a + b" is the body statement.Constructor and Description |
---|
JLambda()
Create an empty lambda without any parameter.
|
Modifier and Type | Method and Description |
---|---|
JLambdaParam |
addParam(AbstractJType aType,
String sName)
Add a parameter with a type name.
|
JLambdaParam |
addParam(String sName)
Add a parameter without a type name.
|
JLambdaBlock |
body() |
void |
generate(JFormatter f) |
int |
paramCount() |
List<JLambdaParam> |
params() |
static JLambda |
simple(IJExpression aExpr)
Create a new no argument lambda that just returns the provided expression.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
_instanceof, band, bor, cand, complement, component, component, component0, cor, decr, div, div, div, div, div, eq, eq0, eqNull, gt, gt, gt0, gte, gte, gte0, incr, invoke, invoke, lt, lt, lt0, lte, lte, lte0, minus, minus, minus, minus, minus, minus, mod, mod, mod, mul, mul, mul, mul, mul, ne, ne0, neNull, not, plus, plus, plus, plus, plus, plus, postdecr, postincr, predecr, preincr, ref, ref, shl, shl, shr, shr, shrz, shrz, xor
@Nonnull public JLambdaParam addParam(@Nonnull String sName)
sName
- The variable name to use. May not be null
.JLambdaParam
object.@Nonnull public JLambdaParam addParam(@Nullable AbstractJType aType, @Nonnull String sName)
aType
- The Type of the parameter. May be null
.sName
- The variable name to use. May not be null
.JLambdaParam
object.@Nonnull public List<JLambdaParam> params()
null
.@Nonnegative public int paramCount()
@Nonnull public JLambdaBlock body()
public void generate(@Nonnull JFormatter f)
generate
in interface IJGenerable
@Nonnull public static JLambda simple(@Nonnull IJExpression aExpr)
aExpr
- Expression to be returned. May not be null
.null
.Copyright © 2013–2017 Philip Helger. All rights reserved.