|
||||||||||
| 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 |
clearEnrichers()
Clears all registered enrichers from the manager. |
void |
clearEvaluators()
Clears all registered evaluators from the manager. |
void |
enrich(String expression,
MuleMessage message,
Object object)
Enriches the current message using |
void |
enrich(String expression,
String enricherName,
MuleMessage message,
Object object)
Enriches the current message |
Object |
evaluate(String expression,
MuleMessage message)
Evaluates the given expression. |
Object |
evaluate(String expression,
MuleMessage message,
boolean failIfNull)
Evaluates the given expression. |
Object |
evaluate(String expression,
String evaluator,
MuleMessage message,
boolean failIfNull)
Evaluates the given expression. |
boolean |
evaluateBoolean(String expression,
MuleMessage message)
Evaluates the given expression resolving the result of the evaluation to a boolean. |
boolean |
evaluateBoolean(String expression,
MuleMessage message,
boolean nullReturnsTrue,
boolean nonBooleanReturnsTrue)
Evaluates the given expression resolving the result of the evaluation to a boolean. |
boolean |
evaluateBoolean(String expression,
String evaluator,
MuleMessage message)
Evaluates the given expression resolving the result of the evaluation to a boolean. |
boolean |
evaluateBoolean(String expression,
String evaluator,
MuleMessage message,
boolean nullReturnsTrue,
boolean nonBooleanReturnsTrue)
Evaluates the given expression resolving the result of the evaluation to a boolean. |
boolean |
isEnricherRegistered(String name)
Checks whether an enricher is registered with the manager |
boolean |
isEvaluatorRegistered(String name)
Checks whether an evaluator is registered with the manager |
boolean |
isExpression(String string)
Determines if the string is an expression. |
boolean |
isValidExpression(String expression)
Determines if the expression is valid or not. |
String |
parse(String expression,
MuleMessage message)
Evaluates expressions in a given string. |
String |
parse(String expression,
MuleMessage message,
boolean failIfNull)
Evaluates expressions in a given string. |
void |
registerEnricher(ExpressionEnricher enricher)
|
void |
registerEvaluator(ExpressionEvaluator evaluator)
|
protected boolean |
resolveBoolean(Object result,
boolean nullReturnsTrue,
boolean nonBooleanReturnsTrue,
String expression)
|
void |
setMuleContext(MuleContext context)
|
ExpressionEnricher |
unregisterEnricher(String name)
Removes the evaluator with the given name |
ExpressionEvaluator |
unregisterEvaluator(String name)
Removes the evaluator with the given name |
void |
validateExpression(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 MuleContextAwarepublic void registerEvaluator(ExpressionEvaluator evaluator)
registerEvaluator in interface ExpressionManagerpublic void registerEnricher(ExpressionEnricher enricher)
registerEnricher in interface ExpressionManagerpublic boolean isEvaluatorRegistered(String name)
isEvaluatorRegistered in interface ExpressionManagername - the name of the expression evaluator
public boolean isEnricherRegistered(String name)
isEnricherRegistered in interface ExpressionManagername - the name of the expression enricher
public ExpressionEvaluator unregisterEvaluator(String name)
unregisterEvaluator in interface ExpressionManagername - the name of the evaluator to remove
public ExpressionEnricher unregisterEnricher(String name)
unregisterEnricher in interface ExpressionManagername - the name of the evaluator to remove
public Object evaluate(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 ExpressionManagerexpression - 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 Object evaluate(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 ExpressionManagerexpression - 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 enrich(String expression,
MuleMessage message,
Object object)
throws ExpressionRuntimeException
ExpressionManager
enrich in interface ExpressionManagerexpression - a single expression i.e. header://foo that defines how the message shoud be enrichedmessage - The current message being processed that will be enrichedobject - The object that will be used to enrich the message
ExpressionRuntimeException
public void enrich(String expression,
String enricherName,
MuleMessage message,
Object object)
ExpressionManager
enrich in interface ExpressionManagerexpression - a single expression i.e. header://foo that defines how the message shoud be enrichedenricherName - the enricher to use when executing the expressionmessage - The current message being processed that will be enrichedobject - The object that will be used to enrich the message
public Object evaluate(String expression,
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 ExpressionManagerexpression - 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 boolean evaluateBoolean(String expression,
String evaluator,
MuleMessage message)
throws ExpressionRuntimeException
ExpressionManager
evaluateBoolean in interface ExpressionManagerexpression - a single expression i.e. header:foo=barevaluator - the evaluator to use when executing the expressionmessage - The current message being processed
ExpressionRuntimeException
public boolean evaluateBoolean(String expression,
MuleMessage message)
throws ExpressionRuntimeException
ExpressionManager
evaluateBoolean in interface ExpressionManagerexpression - a single expression i.e. header:foo=barmessage - The current message being processed
ExpressionRuntimeException
public boolean evaluateBoolean(String expression,
String evaluator,
MuleMessage message,
boolean nullReturnsTrue,
boolean nonBooleanReturnsTrue)
throws ExpressionRuntimeException
ExpressionManager
evaluateBoolean in interface ExpressionManagerexpression - a single expression i.e. header:foo=barevaluator - the evaluator to use when executing the expressionmessage - The current message being processednullReturnsTrue - determines if true should be returned if the result of
the evaluation is nullnonBooleanReturnsTrue - determines if true should returned if the result
is not null but isn't recognised as a boolean
ExpressionRuntimeException
public boolean evaluateBoolean(String expression,
MuleMessage message,
boolean nullReturnsTrue,
boolean nonBooleanReturnsTrue)
throws ExpressionRuntimeException
ExpressionManager
evaluateBoolean in interface ExpressionManagerexpression - a single expression i.e. header:foo=barmessage - The current message being processednullReturnsTrue - determines if true should be returned if the result of
the evaluation is nullnonBooleanReturnsTrue - determines if true should returned if the result
is not null but isn't recognised as a boolean
ExpressionRuntimeException
protected boolean resolveBoolean(Object result,
boolean nullReturnsTrue,
boolean nonBooleanReturnsTrue,
String expression)
public String parse(String expression,
MuleMessage message)
throws ExpressionRuntimeException
ExpressionManager.evaluate(String,org.mule.api.MuleMessage,boolean).
parse in interface ExpressionManagerexpression - 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 String parse(String expression,
MuleMessage message,
boolean failIfNull)
throws ExpressionRuntimeException
ExpressionManager.evaluate(String,org.mule.api.MuleMessage,boolean).
parse in interface ExpressionManagerexpression - 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 ExpressionManagerpublic void clearEnrichers()
ExpressionManager
clearEnrichers in interface ExpressionManagerpublic boolean isExpression(String string)
ExpressionManager
isExpression in interface ExpressionManagerstring - is this string an expression string
public boolean isValidExpression(String expression)
isValidExpression in interface ExpressionManagerexpression - the expression to validate
public void validateExpression(String expression)
throws InvalidExpressionException
ExpressionManager
validateExpression in interface ExpressionManagerexpression - 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 | |||||||||