public class MVELExpressionLanguage extends Object implements ExpressionLanguage, 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 |
protected org.mule.mvel2.ParserConfiguration |
parserConfiguration |
protected org.mule.mvel2.integration.VariableResolverFactory |
staticContext |
PHASE_NAME
Constructor and Description |
---|
MVELExpressionLanguage(MuleContext muleContext) |
Modifier and Type | Method and Description |
---|---|
void |
addAlias(String name,
String expression) |
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 MVELExpressionLanguageContext |
createExpressionLanguageContext() |
static org.mule.mvel2.ParserConfiguration |
createParserConfiguration(Map<String,Class<?>> imports) |
protected void |
createStaticContext() |
protected org.mule.mvel2.integration.VariableResolverFactory |
createVariableVariableResolverFactory(MuleEvent event) |
protected org.mule.mvel2.integration.VariableResolverFactory |
createVariableVariableResolverFactory(MuleMessage message)
Deprecated.
|
void |
enrich(String expression,
MuleMessage message,
TypedValue typedValue)
Enriches a message
|
<T> T |
evaluate(String expression)
Execute the expression returning the result.
|
<T> T |
evaluate(String expression,
Map<String,Object> vars)
Execute the expression returning the result.
|
<T> T |
evaluate(String expression,
MuleEvent event)
Execute the expression returning the result.
|
<T> T |
evaluate(String expression,
MuleEvent event,
Map<String,Object> vars)
Execute the expression returning the result.
|
<T> T |
evaluate(String expression,
MuleMessage message)
Deprecated.
|
<T> T |
evaluate(String expression,
MuleMessage message,
Map<String,Object> vars)
Deprecated.
|
protected <T> T |
evaluateInternal(String expression,
MVELExpressionLanguageContext variableResolverFactory) |
TypedValue |
evaluateTyped(String expression,
MuleMessage message) |
Map<String,String> |
getAliases() |
Map<String,org.mule.mvel2.ast.Function> |
getGlobalFunctions() |
org.mule.mvel2.ParserConfiguration |
getParserConfiguration() |
void |
initialise()
Method used to perform any initialisation work.
|
boolean |
isValid(String expression)
Validates the expression returning true is the expression is valid, false otherwise..
|
protected void |
loadGlobalFunctions() |
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) |
void |
validate(String expression)
Validates the expression returning.
|
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
public MVELExpressionLanguage(MuleContext muleContext)
public void initialise() throws InitialisationException
Initialisable
InitialisationException
should be thrown,
causing the Mule instance to shutdown. If the error is recoverable, say by
retrying to connect, a RecoverableException
should be thrown.
There is no guarantee that by throwing a Recoverable exception that the Mule
instance will not shut down.initialise
in interface Initialisable
InitialisationException
- if a fatal error occurs causing the Mule instance to shutdownRecoverableException
- if an error occurs that can be recovered fromprotected void createStaticContext()
protected void loadGlobalFunctions() throws InitialisationException
InitialisationException
public <T> T evaluate(String expression)
ExpressionLanguage
evaluate
in interface ExpressionLanguage
T
- the return type expectedexpression
- the expression to be executedpublic <T> T evaluate(String expression, Map<String,Object> vars)
ExpressionLanguage
evaluate
in interface ExpressionLanguage
T
- the return type expectedexpression
- the expression to be executedvars
- a map of expression variablespublic <T> T evaluate(String expression, MuleEvent event)
ExpressionLanguage
evaluate
in interface ExpressionLanguage
T
- the return type expectedexpression
- the expression to be executedevent
- the current event being processedpublic <T> T evaluate(String expression, MuleEvent event, Map<String,Object> vars)
ExpressionLanguage
evaluate
in interface ExpressionLanguage
T
- the return type expectedexpression
- the expression to be executedevent
- the current event being processedvars
- a map of expression variables@Deprecated public <T> T evaluate(String expression, MuleMessage message)
ExpressionLanguage
evaluate
in interface ExpressionLanguage
ExpressionLanguage.evaluate(String, MuleEvent)
@Deprecated public <T> T evaluate(String expression, MuleMessage message, Map<String,Object> vars)
ExpressionLanguage
evaluate
in interface ExpressionLanguage
ExpressionLanguage.evaluate(String, MuleEvent)
public void enrich(String expression, MuleMessage message, TypedValue typedValue)
ExpressionLanguage
enrich
in interface ExpressionLanguage
expression
- a single expression i.e. header://foo that defines how the message should be enrichedmessage
- The message to be enrichedtypedValue
- The typed value used for enrichmentpublic TypedValue evaluateTyped(String expression, MuleMessage message)
evaluateTyped
in interface ExpressionLanguage
protected <T> T evaluateInternal(String expression, MVELExpressionLanguageContext variableResolverFactory)
public boolean isValid(String expression)
ExpressionLanguage
isValid
in interface ExpressionLanguage
public void validate(String expression) throws InvalidExpressionException
ExpressionLanguage
InvalidExpressionException
will be thrown is the All
implementors should should validate expression syntactically. Semantic validation is optional.validate
in interface ExpressionLanguage
InvalidExpressionException
protected 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(MuleEvent event)
@Deprecated protected org.mule.mvel2.integration.VariableResolverFactory createVariableVariableResolverFactory(MuleMessage message)
public org.mule.mvel2.ParserConfiguration getParserConfiguration()
Copyright © 2003–2016 MuleSoft, Inc.. All rights reserved.