|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.mule.expression.DefaultExpressionManager
public class DefaultExpressionManager
Provides universal access for evaluating expressions embedded in Mule configurations, such as Xml, Java, scripting and annotations.
Users can register or unregisterExpressionEvaluator
through this interface.
Field Summary | |
---|---|
protected static Log |
logger
logger used by this class |
Fields inherited from interface org.mule.api.expression.ExpressionManager |
---|
DEFAULT_EXPRESSION_POSTFIX, DEFAULT_EXPRESSION_PREFIX |
Constructor Summary | |
---|---|
DefaultExpressionManager()
|
Method Summary | |
---|---|
void |
clearEvaluators()
Clears all registered evaluators from the manager. |
java.lang.Object |
evaluate(java.lang.String expression,
MuleMessage message)
Evaluates the given expression. |
java.lang.Object |
evaluate(java.lang.String expression,
MuleMessage message,
boolean failIfNull)
Evaluates the given expression. |
java.lang.Object |
evaluate(java.lang.String expression,
java.lang.String evaluator,
MuleMessage message,
boolean failIfNull)
Evaluates the given expression. |
boolean |
isEvaluatorRegistered(java.lang.String name)
Checks whether an evaluator is registered with the manager |
boolean |
isExpression(java.lang.String string)
Determines if the string is an expression. |
boolean |
isValidExpression(java.lang.String expression)
Determines if the expression is valid or not. |
java.lang.String |
parse(java.lang.String expression,
MuleMessage message)
Evaluates expressions in a given string. |
java.lang.String |
parse(java.lang.String expression,
MuleMessage message,
boolean failIfNull)
Evaluates expressions in a given string. |
void |
registerEvaluator(ExpressionEvaluator evaluator)
|
void |
setMuleContext(MuleContext context)
|
ExpressionEvaluator |
unregisterEvaluator(java.lang.String name)
Removes the evaluator with the given name |
void |
validateExpression(java.lang.String expression)
Determines if the expression is valid or not. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final transient Log logger
Constructor Detail |
---|
public DefaultExpressionManager()
Method Detail |
---|
public void setMuleContext(MuleContext context)
setMuleContext
in interface MuleContextAware
public void registerEvaluator(ExpressionEvaluator evaluator)
registerEvaluator
in interface ExpressionManager
public boolean isEvaluatorRegistered(java.lang.String name)
isEvaluatorRegistered
in interface ExpressionManager
name
- the name of the expression evaluator
public ExpressionEvaluator unregisterEvaluator(java.lang.String name)
unregisterEvaluator
in interface ExpressionManager
name
- the name of the evaluator to remove
public java.lang.Object evaluate(java.lang.String expression, MuleMessage message) throws ExpressionRuntimeException
ExpressionManager.parse(String,org.mule.api.MuleMessage,boolean)
method should be used since it will iterate through all expressions in a string.
evaluate
in interface ExpressionManager
expression
- a single expression i.e. xpath://foomessage
- the current message to process. The expression will evaluata on the message.
ExpressionRuntimeException
- if the expression is invalid, or a null is found for the expression and
'failIfNull is set to true.public java.lang.Object evaluate(java.lang.String expression, MuleMessage message, boolean failIfNull) throws ExpressionRuntimeException
ExpressionManager.parse(String,org.mule.api.MuleMessage,boolean)
method should be used since it will iterate through all expressions in a string.
evaluate
in interface ExpressionManager
expression
- a single expression i.e. xpath://foomessage
- the current message to process. The expression will evaluata on the message.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 java.lang.Object evaluate(java.lang.String expression, java.lang.String evaluator, MuleMessage message, boolean failIfNull) throws ExpressionRuntimeException
ExpressionManager.parse(String,org.mule.api.MuleMessage,boolean)
method should be used since it will iterate through all expressions in a string.
evaluate
in interface ExpressionManager
expression
- a single expression i.e. xpath://fooevaluator
- the evaluator to use when executing the expressionmessage
- the current message to process. The expression will evaluata on the message.failIfNull
- determines if an exception should be thrown if expression could not be evaluated or returns
null or if an exception should be thrown if an empty collection is returned.
ExpressionRuntimeException
- if the expression is invalid, or a null is found for the expression and
'failIfNull is set to true.public java.lang.String parse(java.lang.String expression, MuleMessage message) throws ExpressionRuntimeException
ExpressionManager.evaluate(String,org.mule.api.MuleMessage,boolean)
.
parse
in interface ExpressionManager
expression
- a single expression i.e. xpath://foomessage
- the current message to process. The expression will evaluata on the message.
ExpressionRuntimeException
- if the expression is invalid, or a null is found for the expression and
'failIfNull is set to true.public java.lang.String parse(java.lang.String expression, MuleMessage message, boolean failIfNull) throws ExpressionRuntimeException
ExpressionManager.evaluate(String,org.mule.api.MuleMessage,boolean)
.
parse
in interface ExpressionManager
expression
- a single expression i.e. xpath://foomessage
- the current message to process. The expression will evaluata on the message.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 void clearEvaluators()
clearEvaluators
in interface ExpressionManager
public boolean isExpression(java.lang.String string)
ExpressionManager
isExpression
in interface ExpressionManager
string
- is this string an expression string
public boolean isValidExpression(java.lang.String expression)
isValidExpression
in interface ExpressionManager
expression
- the expression to validate
public void validateExpression(java.lang.String expression) throws InvalidExpressionException
ExpressionManager
validateExpression
in interface ExpressionManager
expression
- the expression to validate
InvalidExpressionException
- if the expression is invalid, including information about the position and fault
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |