java.lang.Object
org.omnifaces.el.ScopedRunner
This class helps in letting code run within its own scope. Such scope is defined by specific variables being
available to EL within it. The request scope is used to store the variables.
- Author:
- Arjan Tijms
-
Constructor Summary
ConstructorsConstructorDescriptionScopedRunner(FacesContext context) Construct a scoped runner.ScopedRunner(FacesContext context, Map<String, Object> scopedVariables) Construct a scoped runner. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidforEach(FacesContext context, String key, Object value, Runnable callback) Invokes the callback within the scope of the given variable.voidInvokes the callback within the scope of the variables being given in the constructor.Adds the given scoped variable to this instance.
-
Constructor Details
-
ScopedRunner
Construct a scoped runner.- Parameters:
context- The involved faces context.
-
ScopedRunner
Construct a scoped runner.- Parameters:
context- The involved faces context.scopedVariables- Initial scoped variables.
-
-
Method Details
-
with
Adds the given scoped variable to this instance. Can be used in a builder-pattern.- Parameters:
key- the key name of the variablevalue- the value of the variable- Returns:
- this ScopedRunner, so adding variables and finally calling invoke can be chained.
-
invoke
Invokes the callback within the scope of the variables being given in the constructor.- Parameters:
callback- The callback.
-
forEach
Invokes the callback within the scope of the given variable.- Parameters:
context- The involved faces context.key- the key name of the variablevalue- the value of the variablecallback- The callback.- Since:
- 3.0
-