|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.mule.util.expression.ExpressionEvaluatorManager
public class ExpressionEvaluatorManager
Provides universal access for evaluating expressions embedded in Mule configurations, such as Xml, Java,
scripting and annotations.
Users can register or unregister ExpressionEvaluator
through this interface.
Field Summary | |
---|---|
static String |
DEFAULT_EXPRESSION_PREFIX
|
Constructor Summary | |
---|---|
ExpressionEvaluatorManager()
|
Method Summary | |
---|---|
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 |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String DEFAULT_EXPRESSION_PREFIX
Constructor Detail |
---|
public ExpressionEvaluatorManager()
Method Detail |
---|
public static void registerEvaluator(ExpressionEvaluator extractor)
public static boolean isEvaluatorRegistered(String name)
name
- the name of the expression evaluator
public 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 validate
public 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 "${"
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |