Top Description Fields Constructors Methods
javax.el

public Class LambdaExpression

extends Object
Class Inheritance
Imports
java.util.List, .Map, .HashMap, .ArrayList

Encapsulates a parameterized ValueExpression.

A LambdaExpression is a representation of the EL Lambda expression syntax. It consists of a list of the formal parameters and a body, represented by a ValueExpression. The body can be any valid Expression, including another LambdaExpression.

A LambdaExpression is created when an EL expression containing a Lambda expression is evaluated.

A LambdaExpression can be invoked by calling LambdaExpression#invoke, with an javax.el.ELContext and a list of the actual arguments. Alternately, a LambdaExpression can be invoked without passing a ELContext, in which case the ELContext previously set by calling LambdaExpression#setELContext will be used. The evaluation of the ValueExpression in the body uses the ELContext to resolve references to the parameters, and to evaluate the lambda expression. The result of the evaluation is returned.

See Also
ELContext#getLambdaArgument, ELContext#enterLambdaScope, ELContext#exitLambdaScope

Field Summary

Modifier and TypeField and Description
private ELContext
private Map<String, Object>
private ValueExpression
private List<String>

Constructor Summary

AccessConstructor and Description
public
LambdaExpression(List<String>
The list of String representing the formal parameters.
formalParameters
,
ValueExpression
The ValueExpression representing the body.
expression
)

Creates a new LambdaExpression.

Method Summary

Modifier and TypeMethod and Description
public Object

Returns:

The result of invoking the Lambda expression
invoke
(ELContext
The ELContext used for the evaluation of the expression The ELContext set by setELContext is ignored.
elContext
,
Object...
The arguments to invoke the Lambda expression. For calls with no arguments, an empty array must be provided. A Lambda argument can be null.
args
)

Invoke the encapsulated Lambda expression.

public Object

Returns:

The result of invoking the Lambda expression
invoke
(Object...
The arguments to invoke the Lambda expression. For calls with no arguments, an empty array must be provided. A Lambda argument can be null.
args
)

Invoke the encapsulated Lambda expression.

public void
setELContext(ELContext
The ELContext to use in evaluating the LambdaExpression.
context
)

Set the ELContext to use in evaluating the LambdaExpression.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

contextback to summary
private ELContext context
envirArgsback to summary
private Map<String, Object> envirArgs
expressionback to summary
private ValueExpression expression
formalParametersback to summary
private List<String> formalParameters

Constructor Detail

LambdaExpressionback to summary
public LambdaExpression(List<String> formalParameters, ValueExpression expression)

Creates a new LambdaExpression.

Parameters
formalParameters:List<String>

The list of String representing the formal parameters.

expression:ValueExpression

The ValueExpression representing the body.

Method Detail

invokeback to summary
public Object invoke(ELContext elContext, Object... args) throws ELException

Invoke the encapsulated Lambda expression.

The supplied arguments are matched, in the same order, to the formal parameters. If there are more arguments than the formal parameters, the extra arguments are ignored. If there are less arguments than the formal parameters, an ELException is thrown.

The actual Lambda arguments are added to the ELContext and are available during the evaluation of the Lambda expression. They are removed after the evaluation.

Parameters
elContext:ELContext

The ELContext used for the evaluation of the expression The ELContext set by setELContext is ignored.

args:Object[]

The arguments to invoke the Lambda expression. For calls with no arguments, an empty array must be provided. A Lambda argument can be null.

Returns:Object

The result of invoking the Lambda expression

Exceptions
ELException:
if not enough arguments are provided
NullPointerException:
is elContext is null
invokeback to summary
public Object invoke(Object... args)

Invoke the encapsulated Lambda expression.

The supplied arguments are matched, in the same order, to the formal parameters. If there are more arguments than the formal parameters, the extra arguments are ignored. If there are less arguments than the formal parameters, an ELException is thrown.

The actual Lambda arguments are added to the ELContext and are available during the evaluation of the Lambda expression. They are removed after the evaluation.

The ELContext set by LambdaExpression#setELContext is used in the evaluation of the lambda Expression.
Parameters
args:Object[]

The arguments to invoke the Lambda expression. For calls with no arguments, an empty array must be provided. A Lambda argument can be null.

Returns:Object

The result of invoking the Lambda expression

Exceptions
ELException:
if not enough arguments are provided
setELContextback to summary
public void setELContext(ELContext context)

Set the ELContext to use in evaluating the LambdaExpression. The ELContext must to be set prior to the invocation of the LambdaExpression, unless it is supplied with LambdaExpression#invoke.

Parameters
context:ELContext

The ELContext to use in evaluating the LambdaExpression.