public class DefaultExpressionManager extends Object implements ExtendedExpressionManager, org.mule.runtime.api.lifecycle.Initialisable
| Modifier and Type | Field and Description |
|---|---|
static String |
DW_PREFIX |
static String |
MEL_PREFIX |
static String |
PREFIX_EXPR_SEPARATOR |
DEFAULT_EXPRESSION_POSTFIX, DEFAULT_EXPRESSION_PREFIX| Constructor and Description |
|---|
DefaultExpressionManager(MuleContext muleContext,
StreamingManager streamingManager) |
| Modifier and Type | Method and Description |
|---|---|
void |
addGlobalBindings(org.mule.runtime.api.el.BindingContext bindingContext) |
void |
enrich(String expression,
Event event,
Event.Builder eventBuilder,
FlowConstruct flowConstruct,
org.mule.runtime.api.metadata.TypedValue value)
Enriches an event using a typed value.
|
org.mule.runtime.api.metadata.TypedValue |
evaluate(String expression)
Execute the expression returning the result.
|
org.mule.runtime.api.metadata.TypedValue |
evaluate(String expression,
org.mule.runtime.api.el.BindingContext context) |
org.mule.runtime.api.metadata.TypedValue |
evaluate(String expression,
org.mule.runtime.api.metadata.DataType outputType)
Evaluates an expression according to the global
BindingContext and the DataType of the expected result. |
org.mule.runtime.api.metadata.TypedValue |
evaluate(String expression,
org.mule.runtime.api.metadata.DataType outputType,
org.mule.runtime.api.el.BindingContext context) |
org.mule.runtime.api.metadata.TypedValue |
evaluate(String expression,
org.mule.runtime.api.metadata.DataType outputType,
org.mule.runtime.api.el.BindingContext context,
Event event)
Evaluates an expression according to a given
BindingContext, the global one, the DataType of the expected
result and an Event. |
org.mule.runtime.api.metadata.TypedValue |
evaluate(String expression,
org.mule.runtime.api.metadata.DataType outputType,
org.mule.runtime.api.el.BindingContext context,
Event event,
FlowConstruct flowConstruct,
boolean failOnNull)
Evaluates an expression according to a given
BindingContext, the global one, the DataType of the expected
result and an Event. |
org.mule.runtime.api.metadata.TypedValue |
evaluate(String expression,
Event event)
Execute the expression returning the result.
|
org.mule.runtime.api.metadata.TypedValue |
evaluate(String expression,
Event event,
org.mule.runtime.api.el.BindingContext context)
Execute the expression returning the result.
|
org.mule.runtime.api.metadata.TypedValue |
evaluate(String expression,
Event event,
Event.Builder eventBuilder,
FlowConstruct flowConstruct)
Execute the expression returning the result.
|
org.mule.runtime.api.metadata.TypedValue |
evaluate(String expression,
Event event,
FlowConstruct flowConstruct)
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 context)
Execute the expression returning the result.
|
boolean |
evaluateBoolean(String expression,
Event event,
FlowConstruct flowConstruct)
Evaluates an expression considering a
boolean as output. |
boolean |
evaluateBoolean(String expression,
Event event,
FlowConstruct flowConstruct,
boolean nullReturnsTrue,
boolean nonBooleanReturnsTrue)
Evaluates an expression considering a
boolean as output. |
static boolean |
hasMelExpression(String expression)
Checks if an expression has MEL prefix.
|
void |
initialise() |
boolean |
isExpression(String expression) |
boolean |
isValid(String expression) |
String |
parse(String expression,
Event event,
FlowConstruct flowConstruct)
Evaluates expressions in a given string.
|
protected boolean |
resolveBoolean(Object result,
boolean nullReturnsTrue,
boolean nonBooleanReturnsTrue,
String expression) |
Iterator<org.mule.runtime.api.metadata.TypedValue<?>> |
split(String expression,
org.mule.runtime.api.el.BindingContext context) |
Iterator<org.mule.runtime.api.metadata.TypedValue<?>> |
split(String expression,
Event event,
org.mule.runtime.api.el.BindingContext bindingContext)
|
Iterator<org.mule.runtime.api.metadata.TypedValue<?>> |
split(String expression,
Event event,
FlowConstruct flowConstruct,
org.mule.runtime.api.el.BindingContext bindingContext)
|
org.mule.runtime.api.el.ValidationResult |
validate(String expression) |
public static final String DW_PREFIX
public static final String MEL_PREFIX
public static final String PREFIX_EXPR_SEPARATOR
@Inject public DefaultExpressionManager(MuleContext muleContext, StreamingManager streamingManager)
public void initialise()
throws org.mule.runtime.api.lifecycle.InitialisationException
initialise in interface org.mule.runtime.api.lifecycle.Initialisableorg.mule.runtime.api.lifecycle.InitialisationExceptionpublic void addGlobalBindings(org.mule.runtime.api.el.BindingContext bindingContext)
addGlobalBindings in interface org.mule.runtime.api.el.ExpressionLanguagepublic org.mule.runtime.api.metadata.TypedValue evaluate(String expression)
ExpressionManagerevaluate in interface ExpressionManagerexpression - the expression to be executedpublic org.mule.runtime.api.metadata.TypedValue evaluate(String expression, Event event)
ExpressionManager
This version of evaluate performs expression evaulation on an immutable event. Any Event or
InternalMessage mutation performed within the expression will impact within the context of
expression evaluation but will not mutated the event parameter.
evaluate in interface ExpressionManagerexpression - the expression to be executedevent - the current event being processedpublic org.mule.runtime.api.metadata.TypedValue evaluate(String expression, org.mule.runtime.api.el.BindingContext context)
evaluate in interface org.mule.runtime.api.el.ExpressionLanguagepublic org.mule.runtime.api.metadata.TypedValue evaluate(String expression, Event event, org.mule.runtime.api.el.BindingContext context)
ExpressionManager
This version of evaluate performs expression evaulation on an immutable event. Any Event or
InternalMessage mutation performed within the expression will impact within the context of
expression evaluation but will not mutated the event parameter.
evaluate in interface ExpressionManagerexpression - the expression to be executedevent - the current event being processedcontext - the bindings to be consideredpublic org.mule.runtime.api.metadata.TypedValue evaluate(String expression, Event event, FlowConstruct flowConstruct)
ExpressionManager
This version of evaluate performs expression evaulation on an immutable event. Any Event or
InternalMessage mutation performed within the expression will impact within the context of
expression evaluation but will not mutated the event parameter.
evaluate in interface ExpressionManagerexpression - the expression to be executedevent - the current event being processedflowConstruct - the flow where the event is being processedpublic org.mule.runtime.api.metadata.TypedValue evaluate(String expression, Event event, Event.Builder eventBuilder, FlowConstruct flowConstruct)
ExtendedExpressionManager
This version of evaluate 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 ExtendedExpressionManagerexpression - 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 processedpublic org.mule.runtime.api.metadata.TypedValue evaluate(String expression, Event event, FlowConstruct flowConstruct, org.mule.runtime.api.el.BindingContext context)
ExpressionManager
This version of evaluate performs expression evaulation on an immutable event. Any Event or
InternalMessage mutation performed within the expression will impact within the context of
expression evaluation but will not mutated the event parameter.
evaluate in interface ExpressionManagerexpression - the expression to be executedevent - the current event being processedflowConstruct - the flow where the event is being processedcontext - the bindings to be consideredpublic org.mule.runtime.api.metadata.TypedValue evaluate(String expression, org.mule.runtime.api.metadata.DataType outputType)
ExpressionManagerBindingContext and the DataType of the expected result.evaluate in interface ExpressionManagerexpression - the EL expressionoutputType - the expected output type so that automatic conversion can be performed for the resulting value type.public org.mule.runtime.api.metadata.TypedValue evaluate(String expression, org.mule.runtime.api.metadata.DataType outputType, org.mule.runtime.api.el.BindingContext context)
evaluate in interface org.mule.runtime.api.el.ExpressionLanguagepublic org.mule.runtime.api.metadata.TypedValue evaluate(String expression, org.mule.runtime.api.metadata.DataType outputType, org.mule.runtime.api.el.BindingContext context, Event event)
ExpressionManagerBindingContext, the global one, the DataType of the expected
result and an Event.evaluate in interface ExpressionManagerexpression - the EL expressionoutputType - the expected output type so that automatic conversion can be performed for the resulting value
type.context - an expression binding context to considerevent - the current event to considerpublic org.mule.runtime.api.metadata.TypedValue evaluate(String expression, org.mule.runtime.api.metadata.DataType outputType, org.mule.runtime.api.el.BindingContext context, Event event, FlowConstruct flowConstruct, boolean failOnNull) throws ExpressionRuntimeException
ExpressionManagerBindingContext, the global one, the DataType of the expected
result and an Event.evaluate in interface ExpressionManagerexpression - the EL expressionoutputType - the expected output type so that automatic conversion can be performed for the resulting value
type.context - an expression binding context to considerevent - the current event to considerflowConstruct - the flow where the event is being processedfailOnNull - indicates if should fail if the evaluation result is nullExpressionRuntimeException - if a problem occurs evaluating the expression or during transformationpublic void enrich(String expression, Event event, Event.Builder eventBuilder, FlowConstruct flowConstruct, org.mule.runtime.api.metadata.TypedValue value)
ExtendedExpressionManager
This version of enrich 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 ExtendedExpressionManagerexpression - 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 processedvalue - The typed value used for enrichmentpublic boolean evaluateBoolean(String expression, Event event, FlowConstruct flowConstruct) throws ExpressionRuntimeException
ExpressionManagerboolean as output. If the result cannot be clearly transformed or is
null, false will be returned.evaluateBoolean in interface ExpressionManagerexpression - a single expression to be evaluated and transformedevent - the Event to considerflowConstruct - the FlowConstruct to considertrue if the expression evaluated to that or "true", false otherwiseExpressionRuntimeException - if a problem occurs evaluating the expressionpublic boolean evaluateBoolean(String expression, Event event, FlowConstruct flowConstruct, boolean nullReturnsTrue, boolean nonBooleanReturnsTrue) throws ExpressionRuntimeException
ExpressionManagerboolean as output.evaluateBoolean in interface ExpressionManagerexpression - a single expression to be evaluated and transformedevent - the Event to considerflowConstruct - the FlowConstruct to considernullReturnsTrue - whether or not a null outcome should be considered a truenonBooleanReturnsTrue - whether or not a non boolean outcome should be considered a truetrue if the expression evaluated to that, "true" or the above flags where considered, false otherwiseExpressionRuntimeException - if a problem occurs evaluating the expressionprotected boolean resolveBoolean(Object result, boolean nullReturnsTrue, boolean nonBooleanReturnsTrue, String expression)
public String parse(String expression, Event event, FlowConstruct flowConstruct) throws ExpressionRuntimeException
ExtendedExpressionManagerExpressionManager.evaluate(String, Event, FlowConstruct, BindingContext).
This version of evaluate performs expression evaulation on an immutable event. Any Event or
InternalMessage mutation performed within the expression will impact within the context of expression evaluation but
will not mutated the event parameter.
parse in interface ExtendedExpressionManagerexpression - one or more expressions ebedded in a literal string i.e. "Value is #[mel:xpath://foo] other value is
#[mel:header:foo]."event - The current event being processedflowConstruct - the flow where the event is being processedExpressionRuntimeException - if the expression is invalid, or a null is found for the expression and 'failIfNull is set
to true.public Iterator<org.mule.runtime.api.metadata.TypedValue<?>> split(String expression, Event event, FlowConstruct flowConstruct, org.mule.runtime.api.el.BindingContext bindingContext) throws ExpressionRuntimeException
ExpressionManagersplit in interface ExpressionManagerexpression - 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
ExpressionManagersplit in interface ExpressionManagerexpression - the expression to be executedevent - the current event being processedbindingContext - the bindings to considerExpressionRuntimeException - if a problem occurs evaluating the expressionpublic boolean isExpression(String expression)
isExpression in interface org.mule.runtime.api.el.MuleExpressionLanguagepublic boolean isValid(String expression)
isValid in interface org.mule.runtime.api.el.MuleExpressionLanguagepublic org.mule.runtime.api.el.ValidationResult validate(String expression)
validate in interface org.mule.runtime.api.el.ExpressionLanguagepublic Iterator<org.mule.runtime.api.metadata.TypedValue<?>> split(String expression, org.mule.runtime.api.el.BindingContext context)
split in interface org.mule.runtime.api.el.ExpressionLanguagepublic static boolean hasMelExpression(String expression)
expression - the expression to check to see if is a MEL expression.Copyright © 2003–2017 MuleSoft, Inc.. All rights reserved.