public class MVELExpressionLanguage extends Object implements ExtendedExpressionLanguageAdaptor, org.mule.runtime.api.lifecycle.Initialisable
| Modifier and Type | Field and Description |
|---|---|
protected Map<String,String> |
aliases |
protected boolean |
autoResolveVariables |
protected MvelEnricherDataTypePropagator |
dataTypePropagator |
protected MvelDataTypeResolver |
dataTypeResolver |
protected MVELExpressionExecutor |
expressionExecutor |
protected org.mule.mvel2.integration.VariableResolverFactory |
globalContext |
protected Map<String,org.mule.mvel2.ast.Function> |
globalFunctions |
protected String |
globalFunctionsFile |
protected String |
globalFunctionsString |
protected Map<String,Class<?>> |
imports |
protected MuleContext |
muleContext |
static String |
OBJECT_FOR_ENRICHMENT |
protected org.mule.mvel2.ParserConfiguration |
parserConfiguration |
protected org.mule.mvel2.integration.VariableResolverFactory |
staticContext |
| Constructor and Description |
|---|
MVELExpressionLanguage(MuleContext muleContext) |
| Modifier and Type | Method and Description |
|---|---|
void |
addAlias(String name,
String expression) |
void |
addGlobalBindings(org.mule.runtime.api.el.BindingContext bindingContext)
Registers the given
BindingContext entries as globals. |
void |
addGlobalFunction(String name,
org.mule.mvel2.ast.Function function) |
void |
addImport(String name,
Class<?> clazz) |
protected static void |
configureParserConfiguration(org.mule.mvel2.ParserConfiguration parserConfiguration,
Map<String,Class<?>> imports) |
protected String |
createEnrichmentExpression(String expression) |
protected MVELExpressionLanguageContext |
createExpressionLanguageContext() |
static org.mule.mvel2.ParserConfiguration |
createParserConfiguration(Map<String,Class<?>> imports) |
protected void |
createStaticContext() |
protected org.mule.mvel2.integration.VariableResolverFactory |
createVariableVariableResolverFactory(Event event,
Event.Builder eventBuilder) |
void |
enrich(String expression,
Event event,
Event.Builder eventBuilder,
FlowConstruct flowConstruct,
Object object)
Enriches an event.
|
void |
enrich(String expression,
Event event,
Event.Builder eventBuilder,
FlowConstruct flowConstruct,
org.mule.runtime.api.metadata.TypedValue typedValue)
Enriches an event using a typed value.
|
org.mule.runtime.api.metadata.TypedValue |
evaluate(String expression,
org.mule.runtime.api.metadata.DataType expectedOutputType,
Event event,
org.mule.runtime.api.el.BindingContext context)
Evaluates an expression according to a given
BindingContext and outputs . |
org.mule.runtime.api.metadata.TypedValue |
evaluate(String expression,
org.mule.runtime.api.metadata.DataType expectedOutputType,
Event event,
FlowConstruct flowConstruct,
org.mule.runtime.api.el.BindingContext context,
boolean failOnNull)
|
org.mule.runtime.api.metadata.TypedValue |
evaluate(String expression,
Event event,
org.mule.runtime.api.el.BindingContext context)
Evaluates an expression according to a given
BindingContext. |
org.mule.runtime.api.metadata.TypedValue |
evaluate(String expression,
Event event,
Event.Builder eventBuilder,
FlowConstruct flowConstruct,
org.mule.runtime.api.el.BindingContext bindingContext)
Execute the expression returning the result.
|
org.mule.runtime.api.metadata.TypedValue |
evaluate(String expression,
Event event,
FlowConstruct flowConstruct,
org.mule.runtime.api.el.BindingContext bindingContext)
|
protected <T> T |
evaluateInternal(String expression,
MVELExpressionLanguageContext variableResolverFactory) |
<T> T |
evaluateUntyped(String expression,
Event event,
Event.Builder eventBuilder,
FlowConstruct flowConstruct,
Map<String,Object> vars) |
<T> T |
evaluateUntyped(String expression,
Map<String,Object> vars) |
Map<String,String> |
getAliases() |
Map<String,org.mule.mvel2.ast.Function> |
getGlobalFunctions() |
org.mule.mvel2.ParserConfiguration |
getParserConfiguration() |
void |
initialise() |
protected void |
loadGlobalFunctions() |
static String |
removeExpressionMarker(String expression) |
void |
setAliases(Map<String,String> aliases) |
void |
setAutoResolveVariables(boolean autoResolveVariables) |
void |
setDataTypeResolver(MvelDataTypeResolver dataTypeResolver) |
void |
setGlobalFunctionsFile(String globalFunctionsFile) |
void |
setGlobalFunctionsString(String globalFunctionsString) |
void |
setImports(Map<String,Class<?>> imports) |
Iterator<org.mule.runtime.api.metadata.TypedValue<?>> |
split(String expression,
Event event,
org.mule.runtime.api.el.BindingContext bindingContext)
Splits using the specified expression and group it with the batch size.
|
Iterator<org.mule.runtime.api.metadata.TypedValue<?>> |
split(String expression,
Event event,
FlowConstruct flowConstruct,
org.mule.runtime.api.el.BindingContext bindingContext)
Splits using the specified expression and group it with the batch size.
|
org.mule.runtime.api.el.ValidationResult |
validate(String expression)
Verifies whether an expression is valid or not syntactically.
|
public static final String OBJECT_FOR_ENRICHMENT
protected org.mule.mvel2.ParserConfiguration parserConfiguration
protected MuleContext muleContext
protected MVELExpressionExecutor expressionExecutor
protected org.mule.mvel2.integration.VariableResolverFactory staticContext
protected org.mule.mvel2.integration.VariableResolverFactory globalContext
protected String globalFunctionsString
protected String globalFunctionsFile
protected boolean autoResolveVariables
protected MvelDataTypeResolver dataTypeResolver
protected MvelEnricherDataTypePropagator dataTypePropagator
@Inject public MVELExpressionLanguage(MuleContext muleContext)
public void initialise()
throws org.mule.runtime.api.lifecycle.InitialisationException
initialise in interface org.mule.runtime.api.lifecycle.Initialisableorg.mule.runtime.api.lifecycle.InitialisationExceptionprotected void createStaticContext()
protected void loadGlobalFunctions()
throws org.mule.runtime.api.lifecycle.InitialisationException
org.mule.runtime.api.lifecycle.InitialisationExceptionpublic <T> T evaluateUntyped(String expression, Event event, Event.Builder eventBuilder, FlowConstruct flowConstruct, Map<String,Object> vars)
public void enrich(String expression, Event event, Event.Builder eventBuilder, FlowConstruct flowConstruct, Object object)
ExtendedExpressionLanguageAdaptorenrich allows Event or InternalMessage mutation performed
within the expression to be maintained post-evaluation via the use of a result
Event.Builder which should be created from the original event before being passed and then
used to construct the post-evaluation event.enrich in interface ExtendedExpressionLanguageAdaptorexpression - a single expression i.e. header://foo that defines how the message should be enrichedevent - The event to be enrichedeventBuilder - event builder instance used to mutate the current message or event.flowConstruct - the flow where the event is being processedobject - The object used for enrichmentpublic void enrich(String expression, Event event, Event.Builder eventBuilder, FlowConstruct flowConstruct, org.mule.runtime.api.metadata.TypedValue typedValue)
ExtendedExpressionLanguageAdaptorenrich allows Event or InternalMessage mutation performed
within the expression to be maintained post-evaluation via the use of a result
Event.Builder which should be created from the original event before being passed and then
used to construct the post-evaluation event.enrich in interface ExtendedExpressionLanguageAdaptorexpression - a single expression i.e. header://foo that defines how the message should be enrichedevent - The event to be enrichedeventBuilder - event builder instance used to mutate the current message or event.flowConstruct - the flow where the event is being processedtypedValue - The typed value used for enrichmentpublic Iterator<org.mule.runtime.api.metadata.TypedValue<?>> split(String expression, Event event, FlowConstruct flowConstruct, org.mule.runtime.api.el.BindingContext bindingContext) throws ExpressionRuntimeException
ExpressionLanguageAdaptorsplit in interface ExpressionLanguageAdaptorexpression - the expression to be executedevent - the current event being processedflowConstruct - the flow where the event is being processedbindingContext - the bindings to considerExpressionRuntimeException - if a problem occurs evaluating the expressionpublic Iterator<org.mule.runtime.api.metadata.TypedValue<?>> split(String expression, Event event, org.mule.runtime.api.el.BindingContext bindingContext) throws ExpressionRuntimeException
ExpressionLanguageAdaptorsplit in interface ExpressionLanguageAdaptorexpression - the expression to be executedevent - the current event being processedbindingContext - the bindings to considerExpressionRuntimeException - if a problem occurs evaluating the expressionpublic void addGlobalBindings(org.mule.runtime.api.el.BindingContext bindingContext)
ExpressionLanguageAdaptorBindingContext entries as globals. Notice globals cannot be removed once registered, only
overwritten by the registration of a binding with the same identifier.
Implementations should be thread safe to avoid race conditions between registration and expression evaluation.addGlobalBindings in interface ExpressionLanguageAdaptorbindingContext - the context to registerpublic org.mule.runtime.api.metadata.TypedValue evaluate(String expression, Event event, org.mule.runtime.api.el.BindingContext context)
ExpressionLanguageAdaptorBindingContext.evaluate in interface ExpressionLanguageAdaptorexpression - the expression to be executedevent - the current event being processedpublic org.mule.runtime.api.metadata.TypedValue evaluate(String expression, org.mule.runtime.api.metadata.DataType expectedOutputType, Event event, org.mule.runtime.api.el.BindingContext context) throws ExpressionRuntimeException
ExpressionLanguageAdaptorBindingContext and outputs .evaluate in interface ExpressionLanguageAdaptorexpression - the expression to be executedexpectedOutputType - the expected output type so that automatic conversion can be performed for the resulting value
type.event - the current event being processedExpressionRuntimeException - if a problem occurs evaluating the expressionpublic org.mule.runtime.api.metadata.TypedValue evaluate(String expression, org.mule.runtime.api.metadata.DataType expectedOutputType, Event event, FlowConstruct flowConstruct, org.mule.runtime.api.el.BindingContext context, boolean failOnNull) throws ExpressionRuntimeException
ExpressionLanguageAdaptorevaluate in interface ExpressionLanguageAdaptorexpression - the expression to be executedexpectedOutputType - the expected output type so that automatic conversion can be performed for the resulting value
type.event - the current event being processedflowConstruct - the flow where the event is being processedcontext - the bindings to considerfailOnNull - indicates if should fail if the evaluation result is nullExpressionRuntimeException - if a problem occurs evaluating the expressionpublic org.mule.runtime.api.metadata.TypedValue evaluate(String expression, Event event, FlowConstruct flowConstruct, org.mule.runtime.api.el.BindingContext bindingContext)
ExpressionLanguageAdaptorevaluate in interface ExpressionLanguageAdaptorexpression - the expression to be executedevent - the current event being processedflowConstruct - the flow where the event is being processedbindingContext - the bindings to considerpublic org.mule.runtime.api.metadata.TypedValue evaluate(String expression, Event event, Event.Builder eventBuilder, FlowConstruct flowConstruct, org.mule.runtime.api.el.BindingContext bindingContext)
ExtendedExpressionLanguageAdaptorevaluate allows Event or InternalMessage mutation performed
within the expression to be maintained post-evaluation via the use of a result
Event.Builder which should be created from the original event before being passed and then
used to construct the post-evaluation event.evaluate in interface ExtendedExpressionLanguageAdaptorexpression - the expression to be executedevent - the current event being processedeventBuilder - event builder instance used to mutate the current message or event.flowConstruct - the flow where the event is being processedbindingContext - the bindings to considerprotected <T> T evaluateInternal(String expression, MVELExpressionLanguageContext variableResolverFactory)
public org.mule.runtime.api.el.ValidationResult validate(String expression)
ExpressionLanguageAdaptorvalidate in interface ExpressionLanguageAdaptorexpression - to be validatedValidationResult indicating whether the validation was successful or notprotected MVELExpressionLanguageContext createExpressionLanguageContext()
public static org.mule.mvel2.ParserConfiguration createParserConfiguration(Map<String,Class<?>> imports)
protected static void configureParserConfiguration(org.mule.mvel2.ParserConfiguration parserConfiguration,
Map<String,Class<?>> imports)
public void setGlobalFunctionsString(String globalFunctionsString)
public void setAutoResolveVariables(boolean autoResolveVariables)
public void setDataTypeResolver(MvelDataTypeResolver dataTypeResolver)
public void addGlobalFunction(String name, org.mule.mvel2.ast.Function function)
public void setGlobalFunctionsFile(String globalFunctionsFile)
protected org.mule.mvel2.integration.VariableResolverFactory createVariableVariableResolverFactory(Event event, Event.Builder eventBuilder)
public org.mule.mvel2.ParserConfiguration getParserConfiguration()
Copyright © 2003–2017 MuleSoft, Inc.. All rights reserved.