public class ExpressionEvaluatorManager extends Object
ExpressionEvaluator
through this interface.Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_EXPRESSION_PREFIX |
Constructor and Description |
---|
ExpressionEvaluatorManager() |
Modifier and Type | Method and Description |
---|---|
static void |
clearEvaluators()
Clears all registered evaluators from the manager.
|
static Object |
evaluate(String expression,
Object object)
Evaluates the given expression.
|
static Object |
evaluate(String expression,
Object object,
boolean failIfNull)
Evaluates the given expression.
|
static Object |
evaluate(String expression,
Object object,
String expressionPrefix,
boolean failIfNull)
Evaluates the given expression.
|
static Object |
evaluate(String expression,
String evaluator,
Object object,
boolean failIfNull)
Evaluates the given expression.
|
static boolean |
isEvaluatorRegistered(String name)
Checks whether an evaluator is registered with the manager
|
static boolean |
isValidExpression(String expression)
Determines if the expression is valid or not.
|
static boolean |
isValidExpression(String expression,
String expressionPrefix)
Determines if the expression is valid or not.
|
static String |
parse(String expression,
Object object)
Evaluates expressions in a given string.
|
static String |
parse(String expression,
Object object,
boolean failIfNull)
Evaluates expressions in a given string.
|
static void |
registerEvaluator(ExpressionEvaluator extractor) |
static ExpressionEvaluator |
unregisterEvaluator(String name)
Removes the evaluator with the given name
|
public static final String DEFAULT_EXPRESSION_PREFIX
public static void registerEvaluator(ExpressionEvaluator extractor)
public static boolean isEvaluatorRegistered(String name)
name
- the name of the expression evaluatorpublic static ExpressionEvaluator unregisterEvaluator(String name)
name
- the name of the evaluator to removepublic static Object evaluate(String expression, Object object) throws ExpressionRuntimeException
parse(String, Object, boolean)
method should be used since it will iterate through all expressions in a string.expression
- a single expression i.e. xpath://fooobject
- The object (usually MuleMessage
) to evaluate the expression on.ExpressionRuntimeException
- if the expression is invalid, or a null is found for the expression and
'failIfNull is set to true.public static Object evaluate(String expression, Object object, boolean failIfNull) throws ExpressionRuntimeException
parse(String, Object, boolean)
method should be used since it will iterate through all expressions in a string.expression
- a single expression i.e. xpath://fooobject
- The object (usually MuleMessage
) to evaluate the expression on.failIfNull
- determines if an exception should be thrown if expression could not be evaluated or returns
null.ExpressionRuntimeException
- if the expression is invalid, or a null is found for the expression and
'failIfNull is set to true.public static Object evaluate(String expression, String evaluator, Object object, boolean failIfNull) throws ExpressionRuntimeException
parse(String, Object, boolean)
method should be used since it will iterate through all expressions in a string.expression
- a single expression i.e. xpath://fooevaluator
- the evaluator to use when executing the expressionobject
- The object (usually MuleMessage
) to evaluate the expression on.
It is unlikely that users will want to change this execpt maybe to use "[" instead.failIfNull
- determines if an exception should be thrown if expression could not be evaluated or returns
null.ExpressionRuntimeException
- if the expression is invalid, or a null is found for the expression and
'failIfNull is set to true.public static Object evaluate(String expression, Object object, String expressionPrefix, boolean failIfNull) throws ExpressionRuntimeException
parse(String, Object, boolean)
method should be used since it will iterate through all expressions in a string.expression
- a single expression i.e. xpath://fooobject
- The object (usually MuleMessage
) to evaluate the expression on.expressionPrefix
- the expression prefix to use. The default is "${" but any character is valid.
It is unlikely that users will want to change this except maybe to use "[" instead.failIfNull
- determines if an exception should be thrown if expression could not be evaluated or returns
null.ExpressionRuntimeException
- if the expression is invalid, or a null is found for the expression and
'failIfNull is set to true.public static String parse(String expression, Object object) throws ExpressionRuntimeException
evaluate(String, Object, boolean)
.expression
- a single expression i.e. xpath://fooobject
- The object (usually MuleMessage
) to evaluate the expression on.ExpressionRuntimeException
- if the expression is invalid, or a null is found for the expression and
'failIfNull is set to true.public static String parse(String expression, Object object, boolean failIfNull) throws ExpressionRuntimeException
evaluate(String, Object, boolean)
.expression
- a single expression i.e. xpath://fooobject
- The object (usually MuleMessage
) to evaluate the expression on.failIfNull
- determines if an exception should be thrown if expression could not be evaluated or returns
null.ExpressionRuntimeException
- if the expression is invalid, or a null is found for the expression and
'failIfNull is set to true.public static void clearEvaluators()
public static boolean isValidExpression(String expression)
expression
- the expression to validatepublic static boolean isValidExpression(String expression, String expressionPrefix)
expression
- the expression to validateexpressionPrefix
- the prefix used for this expression. if the expression is ${bean:msg.header}
the prefix is "${"Copyright © 2003–2013 MuleSource, Inc.. All rights reserved.